I'm in the process of moving from Apache to nginx but have had to put that on hold because one site I host has rules that I can't make work under nginx. The urls seem to be rewritten correctly, however they always 404.
Here are the rules as they appear in httpd.conf
[code]
RewriteRule ^index.(php|html)$ news.php [QSA]
RewriteRule ^logout.(html)$ user/login.php?do=logout [QSA]
RewriteRule ^news.html$ news.php [QSA]
RewriteRule ^news/(.*),(.*).html$ news.php?id=$1&page=$2 [QSA]
RewriteRule ^news/(.*).html$ news.php?id=$1 [QSA]
RewriteRule ^rss/(.*).(xml|rss)$ rss.php?do=$1 [QSA]
RewriteRule ^gallery/category/(.*)$ gallery.php?d=$1 [QSA]
RewriteRule ^gallery$ gallery.php?d=$1 [QSA]
RewriteRule ^gallery/(.*).html$ gallery.php?d=$1 [QSA]
RewriteRule ^gallery.php/category/(.*)$ gallery.php?d=$1 [QSA]
RewriteRule ^manga/(.*).html$ manga.php?path=$1 [QSA]
RewriteRule ^download/(.*).html$ file.php?path=$1 [QSA]
RewriteRule ^view_profile/(.*).html$ user/view_profile.php?user=$1 [QSA]
RewriteRule ^(.*),(.*),(.*).html$ $1.php?do=$2&id=$3 [QSA]
RewriteRule ^(.*),(.*).html$ $1.php?do=$2 [QSA]
RewriteRule ^(.*).html$ $1.php [QSA]
[/code]
and this is what I've been trying in nginx.conf
[code]
location / {
root /home/site;
index news.php;
rewrite ^index.(php|html)$ news.php last;
rewrite ^logout.(html)$ user/login.php?do=logout last;
rewrite ^news.html$ news.php last;
rewrite ^news/(.*),(.*).html$ news.php?id=$1&page=$2 last;
rewrite ^news/(.*).html$ news.php?id=$1 last;
rewrite ^rss/(.*).(xml|rss)$ rss.php?do=$1 last;
rewrite ^gallery/category/(.*)$ gallery.php?d=$1 last;
rewrite ^gallery/(.*).html$ gallery.php?d=$1 last;
rewrite ^gallery.php/category/(.*)$ gallery.php?d=$1 last;
rewrite ^manga/(.*).html$ manga.php?path=$1 last;
rewrite ^download/(.*).html$ file.php?path=$1 last;
rewrite ^view_profile/(.*).html$ user/view_profile.php?user=$1 last;
rewrite ^(.*),(.*),(.*).html$ $1.php?do=$2&id=$3 last;
rewrite ^(.*),(.*).html$ $1.php?do=$2 last;
rewrite ^(.*).html$ $1.php last;
}
[/code]
I was given the httpd.conf rewrites from their coder, but he didn't know how to use nginx so it was up to me to try and convert it over. They're basically all the same except for the addition of last at the end of each rule. As I understand it, nginx does QSA by default.
Is there anything I'm missing?