Home > Backend Development > PHP Tutorial > 关于禁止直接访问文件的问题

关于禁止直接访问文件的问题

WBOY
Release: 2016-06-23 14:21:43
Original
1001 people have browsed it

如下:
后台生成excel文件,放在a/b/test.xls这里,我不希望别人直接输入http://*.com/a/b/test.xls,我希望有权限的人才能访问,无权的则自动跑转,请问该如何处理呢?


回复讨论(解决方案)

最简单就是保存到web以外的目录

在入口文件同级目录加个.htaccess文件

使用apache的权限认证。对这个目录加权限。

apache conf设置目录权限

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template