Rewrite Rules from apache

pratyush at hostindya.com pratyush at hostindya.com
Thu Jul 7 17:19:38 UTC 2016


July 7 2016 10:19 PM, "Daniel" <daniel at linux-nerd.de> wrote:
> 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
> 
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx


how about

location ^/(.*?)/(.*?)/(.*)/(.*)$ {
    try_files /$3 $uri =404;
}



More information about the nginx mailing list