HTTP 基本身份验证排除单个文件
我的 .htaccess 文件的一部分如下所示 - 这样
AuthUserFile /path/to/.htpasswd
AuthName "Authorization Required"
AuthType Basic
require valid-user
做需要对整个目录及其下面的目录进行基本 HTTP 身份验证。但是,我在该根目录中有一个文件 thubservice.php,该文件不需要 HTTP 身份验证。
据我所知,我需要使用
Part of my .htaccess file looks like this-
AuthUserFile /path/to/.htpasswd
AuthName "Authorization Required"
AuthType Basic
require valid-user
Doing that requires the Basic HTTP authentication for the entire directory and the directories below it as well. However, I have a single file within that root directory, thubservice.php, that should not require the HTTP authentication.
From what I have seen, I need to use <FilesMatch />, but I cannot figure out the pattern to match all but that given file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于Apache 2.4,您可能需要使用需要 代替:
With Apache 2.4 you may want to use Require instead: