converting apache rewrites to nginx

Jim Ohlstein jim.ohlstein at
Sun Jan 4 23:28:56 MSK 2009





Assuming your doc root is /var/www/ws, try



location /wiki/ {


if (!-e $request_filename) {

rewrite ^/(.*)$ /index.php?title=$1 last;



rewrite ^/(images|skins)\/(.*)$$1/$2  last;






You may need to add a forward slash in front of http in the second line.



Good luck,






From: owner-nginx at [mailto:owner-nginx at] On Behalf Of
Andrew Thornton
Sent: Sunday, January 04, 2009 3:01 PM
To: nginx at
Subject: converting apache rewrites to nginx



I am currently trying to get a deployment ready in an attempt to migrate my
wiki from apache to nginx and php-fpm. Things have gone pretty smoothly so
far, but I am having a real problem with rewrite rules. Here is what is
currently in my apache config for a rewrite:

<Directory "/var/www/ws/wiki">
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?title=$1 [PT,L,QSA]
RewriteRule ^(images|skins)\/(.*)$$1/$2 [L]

I have tried adding this a couple of different ways into the nginx config
file but it isn't working. Can someone give me a hand with this? Also, where
can I find docs on the rewrite functionality within nginx?

I appreciate any and all help,


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list