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 mysite.com/admin/somefile.xhtml 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?
Thanks
Dave
On Wed, Dec 23, 2009 at 2:24 AM, Dave Kennard
[email protected] wrote:
Authentification and the page will display.
nginx mailing list
[email protected]
nginx Info Page
Hello,
You rewrite the request to something.php which is likely handled by a
separate location that captures all PHP. You should make a PHP
location internal to the location in question. In one of two ways…
Outside of admin like so:
location /admin {
auth_basic …;
…
}
location ~ ^/admin/.*.php {
auth_basic …;
…
}
Inside admin like so:
location /admin {
auth_basic …;
location ~ .php$ { … }
}
Thanks,
Merlin
Thanks Merlin, that works great!
Cheers
Dave