Welcome! Log In Create A New Profile

Advanced

migrating from apache, need help on some rewrite rules

Posted by digrouz 
migrating from apache, need help on some rewrite rules
November 21, 2017 06:11AM
Hello,

I would need some help to convert some apache rewrite rules to nginx,

here is the apache version:
<Location ^/mywebapp>
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from 192.168.0.0/16
Allow from 10.10.0.0/16
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !app_dev\.php/.*
RewriteCond %{REQUEST_URI} !app\.php$
RewriteRule (.*) app.php [QSA,L]
</Location>

here is what I have in nginx:
location ~ ^/mywebapp {
allow 127.0.0.1;
allow 192.168.0.0/16;
allow 10.10.0.0/16;
deny all;

location ~ app_dev\.php/.* { }
location ~ app\.php$ { }
if (!-e $request_filename){
rewrite ^(.*)$ app.php break;
}
}

which does not work as intended. Can someone point me where I'm wrong ?

Kind Regards

Nicolas
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 89
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready