Apache 2.4 .htaccess Request_URI的基本身份验证绕过

时间:2014-09-08 20:52:54

标签: php basic-authentication silex apache2.4

我有一个运行Silex的PHP应用程序,它受基本身份验证保护,但我需要应用程序的一部分不要求密码。我可以在Apache 2.2中做到这一点,但它似乎不适用于2.4。这是我的.htaccess

SetEnvIf Request_URI ^/register noauth=1
AuthType Basic
AuthName "Auth"
AuthUserFile /path/to/.htpasswd
Order Deny,Allow
Satisfy any
Deny from all
Require valid-user
Allow from env=noauth

我知道Apache 2.4有不同的做法,任何人都知道如何?

1 个答案:

答案 0 :(得分:4)

如果有人有兴趣,我会这样修理:

SetEnvIf Request_URI /register noauth=1
AuthType Basic
AuthName "Auth"
AuthUserFile /path/to/.htpasswd
<RequireAny>
    Require env noauth
    Require valid-user
</RequireAny>