.htaccess密码保护拒绝请求uri

时间:2015-10-31 06:59:20

标签: php .htaccess security password-protection

我想请求uri / admin然后.htacccess受保护的密码answer然后允许来自/ admin

此代码无效

SetEnvIf Request_URI ^/admin require_auth=false
AuthType Basic
AuthName "Staging Server"
AuthUserFile /system/pw/.htpasswd
Require valid-user
Order allow,deny
Deny from env=require_auth
Satisfy any
Allow from env=!require_auth

1 个答案:

答案 0 :(得分:0)

#allows a single uri through the .htaccess password protection
SetEnvIf Request_URI "/admin" test_uri
#allows everything if its on a certain host
Order Deny,Allow
AuthName "Restricted Area"
AuthType Basic
AuthUserFile /system/pw/.htpasswd
#Allow valid-user
Deny from env=test_uri
Satisfy any
Require valid-user