Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Basic auth not working with rewrite

$
0
0
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?

Viewing all articles
Browse latest Browse all 4759

Trending Articles