Welcome! Log In Create A New Profile

Advanced

Re: Rewrite Rule convert

December 03, 2010 02:32AM
On Fri, Dec 03, 2010 at 01:54:18AM -0500, u-name wrote:

> 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

Sorry, it's not easy to understand these regexs.
What does "^\/?((cn|en|tw)?\/?news\/\d+)\.html$" mean ?
Should it match "/ennews/5.html", for example ?

You should location instead rewrites, for example:

locaiton = /index.html {
root /path/to/html;
}


--
Igor Sysoev
http://sysoev.ru/en/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Rewrite Rule convert

u-name December 03, 2010 01:54AM

Re: Rewrite Rule convert

Igor Sysoev December 03, 2010 02:32AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 261
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready