本文介绍了.htaccess的访问/下载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用htaccess的我基本上是试图禁止访问该页面即 example ,但它仍将允许人们下载文件,如果他们有直接的联系,即 example/hi.zip
Using htaccess I'm basically trying to forbid access to the page i.e example, but it will still allow people to download files if they have a direct link i.e example/hi.zip.
我使用该目录指令的基本陈列下载页面。据此间 mod_autoindex.c 使用,所以基本上我想要做的是:
I'm using the directory directive to display the basic download page. According to here mod_autoindex.c is used,so basically what I'm trying to do is:
<Files mod_autoindex.c> AuthType Basic AuthName "Example" AuthUserFile "/home/.htpasswd" require valid-user </Files>
任何意见/建议吗?
Any advice/tips?
推荐答案这应该工作(在我的网络服务器进行测试:www.gopeter.de/test受到限制,www.gopeter.de/test/test.zip是允许的)
This should work (tested on my webserver: www.gopeter.de/test is restricted, www.gopeter.de/test/test.zip is allowed)
AuthType Basic AuthName "Restricted Directory" AuthUserFile /path/to/directory/.htpasswd require valid-user <FilesMatch "\.(gz|pdf|zip|rar)$" > Order allow,deny Allow from all Satisfy any </FilesMatch>更多推荐
.htaccess的访问/下载
发布评论