简体   繁体   中英

.htaccess password protection deny from request uri

I want to request uri /admin then .htacccess protected password answer then allow from /admin

This code is not working

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
#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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM