Welcome! Log In Create A New Profile


please help with rewrite

Posted by cliang 
please help with rewrite
August 19, 2009 10:30PM
Hi all,

I'm transferring my web server from Apache 2.2 to Nginx 0.7.61, but there is a problem with rewrite rules.
For example, there are two directories named /forum/ and /forum_real/ (existed), and the url which users requested will be something like "http://domain/forum/aaa/topics/topics.php.id.1". And it is rewrited by:
RewriteRule ^/forum/(\w+)/topics/topic.php.id.([0-9]+)$ /forum_real/forum_name/topics/topic.php?id=$2&name=$1 [L,NC]

I've wrote the rule with Nginx and it works:
rewrite ^/forum/(\w+)/topics/topic.php.id.([0-9]+)$ /forum_real/forum_name/topics/topic.php?id=$2&name=$1 last;

Also, there is another url like "http://domain/f/SOME_WORDS_IN_CHINESE/forum/aaa/topics/topics.php.id.1", the rewrite rule with Apache is:
RewriteRule ^(.*)/forum/(.*)/topics/topic_no.php(.*)$ /forum/$2/topics/topic_no.php$3

So, the second url is rewrited twice. But the rule
rewrite ^/f/(.*)/forum/(.*)/topics/topic_no.php.(.*)$ /forum/$2/topics/topic_no.php.$3;
doesn't work.

Could anyone help me? Thanks!

PS. Sorry for my poor English...
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 107
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready