Welcome! Log In Create A New Profile

Advanced

How would I convert this Apache rewrite to nginx?

Posted by daveyfx 
How would I convert this Apache rewrite to nginx?
May 13, 2010 10:38AM
Hi all,

Wondering if you all could help me convert this Apache rewrite rule over to nginx. I'm wanting to totally drop Apache in favor of PHP-FPM and already do most of my rewrites in nginx.

RewriteCond %{DOCUMENT_ROOT}/$1 -f [OR]
RewriteCond %{DOCUMENT_ROOT}/$1 -d
RewriteRule (.*) - [S=1]

RewriteRule ^(.+)$ /index.php$1

Mainly where I am stumped is how can I implement a similar "skip" clause (i.e. [S=1]) in nginx?

Thanks for your help!
Re: How would I convert this Apache rewrite to nginx?
June 04, 2010 06:05AM
if (-f $document_root/$1){
set $rule_0 1;
}
if (-d $document_root/$1){
set $rule_0 1;
}
if ($rule_0 = "1"){
#ignored: "-" thing used or unknown variable in regex/rew
}
rewrite ^/(.+)$ /index.php$1;


I hope that helps .
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 78
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