Nginx proxying to Apache: what about mod_rewrite?

Jeff Waugh jdub at bethesignal.org
Wed Sep 30 21:34:17 MSD 2009


<quote who="illarra">

> RewriteRule ^(.*)$ index.php?r=$1?%{QUERY_STRING} 
> 
> The question is, where should I put the rewrite condition? in Nginx
> (adapted, of course) or Apache?

You could do either, but you may as well do it in nginx and save Apache the
effort. As a bonus, you can get nginx to serve static files before it passes
the rewritten request to Apache:

  try_files  $uri $uri/  /index.php?r=$request_uri;

Two birds. One stone. :-)

- Jeff

-- 
linux.conf.au 2010: Wellington, NZ                http://www.lca2010.org.nz/
 
   "Maybe you should put some shorts on or something, if you want to keep
              fighting evil today." - The Bowler, Mystery Men





More information about the nginx mailing list