Welcome! Log In Create A New Profile

Advanced

using allow/deny and rewrite together

Posted by datibbaW 
using allow/deny and rewrite together
March 19, 2010 07:35AM
Hi,

I have the following configuration entries:
location /admin/ {
allow x.x.x.x;
deny all;
}

location / {
rewrite . /index.php
}

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
}

If someone accesses /admin/xxx the allow/deny rules are being honoured, but the user sees 404 (because the URL is not rewritten to /index.php)

If I add "rewrite . /index.php" in the /admin/ location section it rewrites the URL, but everyone has access.

Is there a better way?
Re: using allow/deny and rewrite together
March 19, 2010 08:58AM
Hi,

Figured that changing the admin location block to this worked:

location /admin/ {
allow x.x.x.x;
deny all;
rewrite . /index.php break;
}
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 258
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready