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:
[code]
RewriteRule ^/forum/(\w+)/topics/topic.php.id.([0-9]+)$ /forum_real/forum_name/topics/topic.php?id=$2&name=$1 [L,NC]
[/code]

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

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:
[code]
RewriteRule ^(.*)/forum/(.*)/topics/topic_no.php(.*)$ /forum/$2/topics/topic_no.php$3
[/code]

So, the second url is rewrited twice. But the rule
[code]
rewrite ^/f/(.*)/forum/(.*)/topics/topic_no.php.(.*)$ /forum/$2/topics/topic_no.php.$3;
[/code]
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: 137
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready