Rewrite Rules from apache

Daniel daniel at linux-nerd.de
Thu Jul 7 16:49:21 UTC 2016


Hi Everyone,

i try to convert some rules from apache htaccess to nginx.

This is my htaccess Rule:

 RewriteCond %{DOCUMENT_ROOT}/$3 -f
 RewriteRule ^(.*?)/(.*?)/(.*)$ /$3

I tried these options but it seems not working:

if (-f $document_root/$3){
	set $rule_0 1$rule_0;
}
if ($rule_0 = "1"){
	rewrite ^/(.*?)/(.*?)/(.*)$ /$3;
}

Anyone have a good idea?

Cheers

Daniel



More information about the nginx mailing list