I need to protect one directory with the basic auth and rewrite all urls inside this directory only.
I have the following config:
location /admin/ {
auth_basic "Secure area";
auth_basic_user_file .htpasswd;
rewrite ^(.*)$ /admin/index.php last;
}
However, basic auth not working. If I comment rewrite rule it starts working.
How to fix it?
I have the following config:
location /admin/ {
auth_basic "Secure area";
auth_basic_user_file .htpasswd;
rewrite ^(.*)$ /admin/index.php last;
}
However, basic auth not working. If I comment rewrite rule it starts working.
How to fix it?