HTTP基本认证排除单个文件 [英] HTTP Basic Auth Exclude Single File

查看:252
本文介绍了HTTP基本认证排除单个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的.htaccess文件的部分看起来像这样 -

 的AuthUserFile /path/to/.htpasswd
AuthName指令需要授权
与AuthType基本
需要有效的用户
 

否则,需要对整个目录和基本HTTP验证它下面的目录,以及。不过,我内的根目录下,thubservice.php一个文件,不应该要求HTTP验证。

这是我所看到的,我需要使用< FilesMatch />中,但我想不出要匹配的模式,但所有给定文件

解决方案

 的AuthUserFile /path/to/.htpasswd
AuthName指令需要授权
与AuthType基本
需要有效的用户
<文件thubservice.php>
    满足任何
    所有允许
< /文件>
 

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.

解决方案

AuthUserFile /path/to/.htpasswd
AuthName "Authorization Required"
AuthType Basic
require valid-user
<Files "thubservice.php">
    Satisfy Any
    Allow from all
</Files>

这篇关于HTTP基本认证排除单个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆