Welcome! Log In Create A New Profile

Advanced

How could I permanently redirect dynamic url with querystrings?

June 19, 2010 09:53AM
Hi, all

I recently migrates my web server from lighty to nginx(nginx/0.7.67 + php-fpm), but there is something strange with the nginx rewrite rule.


The problem is, I wanna direct rules like this,

http://www1.example.com/dispbbs.asp?boardID=15&ID=164752

to a new domain([b]www2[/b]) and new format as follows,

http://www2.example.com/thread-164752-1-1.html


However, I gets some strange results,
[code]
http://www2.example.com/thread-164752-1-1.html?boardID=15&ID=164752
[/code]

Why? Why does the querystring '[b]?boardID=15&ID=164752[/b]' still appears and so strange?


Here is my settings in nginx.conf
[code]
...

#rewrite dynamic url with querystrings
if ($args ~* "boardid=[0-9]+&id=([0-9]+)") {
set $tid $1;
rewrite ^.*$ http://www2.example.com/thread-$tid-1-1.html permanent;
}
...
#here, i put some rewrite rules#
...
#at the end, rewrite undefined urls permanently
rewrite ^(.*) http://www2.example.com$1 permanent;
...
[/code]



V/R,
gavin
Subject Author Posted

How could I permanently redirect dynamic url with querystrings?

WisdomFusion June 19, 2010 09:53AM

Re: How could I permanently redirect dynamic url with querystrings?

Gena Makhomed June 19, 2010 10:34AM

Re: How could I permanently redirect dynamic url with querystrings?

WisdomFusion June 20, 2010 07:06AM

Re: How could I permanently redirect dynamic url with querystrings?

Gena Makhomed June 20, 2010 08:44AM

Re: How could I permanently redirect dynamic url with querystrings?

WisdomFusion June 21, 2010 09:58PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 180
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