【发布时间】:2016-02-22 15:28:14
【问题描述】:
我写了一个小的下载脚本来隐藏文件路径,文件“get_file.php”处理一切。 下一步我想禁止使用 htaccess 通过浏览器直接访问所有 pdf 文件(如果有人知道文件的确切 url),但仍然使用我的“get_file.php”提供对文件的访问。
我试过了:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost.*$ [NC]
RewriteRule \.(pdf)$ - [F]
有什么想法吗?
【问题讨论】:
标签: php .htaccess pdf mod-rewrite file-access