gpt4 book ai didi

html - htaccess访问/下载

转载 作者:太空宇宙 更新时间:2023-11-04 13:44:04 28 4
gpt4 key购买 nike

使用 htaccess 我基本上试图禁止访问该页面,即 http://example.com , 但它仍然允许人们下载文件,如果他们有直接链接即 http://example.com/hi.zip .

我正在使用目录指令来显示基本的下载页面。根据here mod_autoindex.c 被使用,所以基本上我想做的是:

<Files mod_autoindex.c>
AuthType Basic
AuthName "Example"
AuthUserFile "/home/.htpasswd"
require valid-user
</Files>

有什么建议/提示吗?

最佳答案

这应该有效(在我的网络服务器上测试:www.gopeter.de/test 受限,允许 www.gopeter.de/test/test.zip)

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>

关于html - htaccess访问/下载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9119984/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com