Rewrite problem

Hello,

location ~ /admin/

Above matches every admin folder on the domain but i just want to match
“/admin” on the url like http://domain.com/admin

Tried this location = /admin/

But that did not work. I`m suing this location to password protect.

Posted at Nginx Forum:

How to match every php file under the admin directory? Thanks. I dont
want to match admin folder globally on the domain.

Posted at Nginx Forum:

On Thu, Sep 16, 2010 at 12:37:01PM -0400, st1905 wrote:

Hello,

location ~ /admin/

Above matches every admin folder on the domain but i just want to match
“/admin” on the url like http://domain.com/admin

Tried this location = /admin/

But that did not work. I`m suing this location to password protect.

location = /admin


Igor S.
http://sysoev.ru/en/

Ok, solved this, just in case anyone needs the solution, here it is.

location /admin {
    auth_basic "Restricted";
    auth_basic_user_file /path/to/.htpasswd;
    location ~ \.php$ {
      include fastcgi.conf;
      fastcgi_pass my-backend;
    }
  }

Posted at Nginx Forum:

On Thu, Sep 16, 2010 at 01:15:45PM -0400, st1905 wrote:

How to match every php file under the admin directory? Thanks. I dont
want to match admin folder globally on the domain.

location ~ ^/admin/.+.php$


Igor S.
http://sysoev.ru/en/

Igor S. Wrote:


Igor S.
Igor Sysoev


nginx mailing list
[email protected]
nginx Info Page

That worked great, thank you.

Posted at Nginx Forum: