How could I permanently redirect dynamic url with querystrings?

WisdomFusion nginx-forum at
Sat Jun 19 17:53:32 MSD 2010

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,

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

However, I gets some strange results,

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

Here is my settings in nginx.conf

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


Posted at Nginx Forum:,100268,100268#msg-100268

More information about the nginx mailing list