Basic Auth not requested when rewrite rule exists

Dave Kennard showerheadsuk at
Wed Dec 23 13:24:47 MSK 2009

Part of my Server config looks like this:
location /admin/ {
         auth_basic            "Restricted";
         auth_basic_user_file  /path/to/.htpasswd;

         #rewrite any .xhtml page to page.php
         rewrite ^/(.+)\.xhtml$ /$1.php last;

But when I go to I don't get asked for 
Authentification and the page will display.

If I comment out the rewrite rule then I do get asked for authentification.

Can anyone advise me on how to get authentification and the rewrite rule 
working together?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list