0

任务 1:我正在使用 htaccessOptions -Indexes停止目录列表。但是,我希望它显示 404 page not found 响应而不是 403 禁止响应。我怎样才能为每个目录做到这一点?

任务 2:假设我有一个包含一些可下载文件的目录。有没有办法阻止用户使用 .htaccess 下载文件,直到他们登录到我的网站?

4

1 回答 1

0

任务 1:试试这个

RewriteEngine On
RewriteBase   /my_directory
RewriteRule   ^$ - [R=404,L]

任务 2:首先您需要防止使用 htaccess 直接下载文件。
然后你必须创建你的 php 文件来检查是否登录。
如果然后记录,请将标头设置为目标文件,然后打开它。

这 2 个教程将指导您。
http://www.ssdtutorials.com/tutorials/title/download-file-with-php.html
http://www.devshed.com/c/a/PHP/Simple-and-Secure-PHP-Download-Script -with-Limits-Tutorial/

于 2012-05-03T07:23:44.110 回答