.htaccess的访问/下载

编程入门 行业动态 更新时间:2024-10-23 21:25:46
本文介绍了.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的访问/下载

本文发布于:2023-11-01 20:03:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1550278.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:htaccess

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!