Rewrite Rule convert

u-name nginx-forum at nginx.us
Fri Dec 3 09:54:18 MSK 2010


I am a newer for the nginx
I am tired to convert the rule form apache to nginx but it doesn't
work.
Anyone can help and point out my error?
Thanks

The Source Apache Rule:
RewriteRule ^\/?index\.html$ /html/index.html [L]
RewriteRule
^((ajax/|accounts/|software/download|shortcut|flashcookie)/?.*)$
/index.php/$1 [L]
RewriteRule ^\/?((cn|en|tw)?\/?([a-zA-Z][a-zA-Z0-9_\-]+)*\.html)$
/html/$1 [L]
RewriteRule ^\/?((cn|en|tw)?\/?news\/\d+)\.html$ /html/$1.html [L]

My Convert Rules for Nginx:
rewrite ^/?index\.html$ /html/index.html last;\
rewrite ^((ajax/|accounts/|software/download|shortcut|flashcookie)/?.*)$
/index.php/$1 last;
rewrite ^/\/?((cn|en|tw)?\/?([a-zA-Z][a-zA-Z0-9_\-]+)*\.html)$ /html/$1
last;
rewrite ^\/?((cn|en|tw)?\/?news\/\d+)\.html$ /html/$1.html last;

Now I link to my ajax/|accounts/|software/download|shortcut|flashcookie
page, it show error 404

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,155200,155200#msg-155200




More information about the nginx mailing list