How to make Basic Auth exclude a rewritten file?
location ~ "^/blank.gif" {
auth_basic off;
}
location / {
auth_basic "Restricted Content";
auth_basic_user_file /etc/nginx/.htpasswd;
}
Solve!
SetEnvIf Request_URI "/blank.gif" noauth=1
RewriteEngine on
RewriteRule ^blank.gif$ count.php
AuthType Basic
AuthName "Restricted Content"
AuthUserFile /home/admin/web/domain.com/public_html/.htpasswd
Order Deny,Allow
Satisfy any
Deny from all
Require valid-user
Allow from env=noauth
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.