Apache rewrite in Nginx format

Philip Murray pmurray at open2view.com
Wed Sep 26 08:18:43 MSD 2007


Is it possible to express the following Apache rewrite rule in Nginx?

     RewriteCond %{QUERY_STRING} !^nobranding$
     RewriteCond %{REQUEST_FILENAME} ^/assets/XL/([^.]+)\.([jpegif]+)$
     RewriteCond /usr/local/www/assets-nz/XL/%1.branded.%2 -f
     RewriteRule ^/([^.]+)\.([jpeg]+)$ /$1.branded.$2

In Nginx, this would be in a location block with an alias, so

location /assets {
     alias /usr/local/www/assets-nz/;

     ... rewrites go here ...

But, I understand you can't rewrite with an alias present? So how can  
I implement the above Apache rewrite?


Phil Murray

More information about the nginx mailing list