Migrate from apache mod_rewrite

Andreas Lehr andy at diginights.com
Mon Feb 9 17:52:21 MSK 2009

Hi guys,

I`m trying to migrate one of our external programmed tools to nginx from 
  traditional apache.

But unfortunately I screw things up on migrating apache mod_rewrite to 
nginx mod_rewrite!

Would be great, if one of you could help me on this.
The mod_rewrite sections in apache looks like this:

     RewriteEngine On

     # if thumb exists, output directly
     RewriteCond %{QUERY_STRING} ^(thumb|normal)$
     RewriteCond %{DOCUMENT_ROOT}/cache/$1/%{QUERY_STRING}.jpg -f
     RewriteRule (.*)\.jpg$ /cache/$1/%{QUERY_STRING}.jpg [L]

     # otherwise redirect all jpg-image-requests to processing
     # script if they are not in cache dir
     RewriteCond %{REQUEST_URI} !^/cache
     RewriteRule \.jpg$ /image_processing.php [QSA,L]

How to do this with nginx?

Thank you very very much!

Kind regards,

More information about the nginx mailing list