nginx 0.7.65 rewrite url with querystring problem?

WisdomFusion nginx-forum at
Tue Mar 30 05:51:38 MSD 2010

Hi, all

Recently, I altered my web server lighty to nginx. And now, Struggling with some problems.

First, I have a site in nginx which only rewrites urls and redircts them to a new domain, and this site has exactly no file in its root directory.
I put some rewrite rules (just string rules, no querystring) in my nginx.conf

list 1
rewrite ^/index_([0-9]+)(.*)$ /forum-$1-1.html last;
rewrite ^/dispbbs_([0-9]+)_([0-9]+)\.html$ /thread-$2-1-1.html last;

Those rules work perfect till now.

However, some rules that used to rewrite url with querystring do not work as hoped. 

list 2
location /index.asp {
  if ($arg_boardid ~ "^([0-9]+)") {
    rewrite ^ /forum-$arg_boardid-1.html break;
  rewrite ^ /index.php break;
location /dispbbs.asp {
  rewrite ^ /thread-$arg_id-1-1.html break;

And, these rules are converted from rules under httpd server,

list 3
^/dispbbs\.asp\?boardID=([0-9]+)&ID=([0-9]+).*$ /thread-$2-1-1.html;
^/dispbbs\.asp\?(.*)&id=([0-9]+)(.*)$ /thread-$2-1-1.html;
^/index\.asp\?boardid=([0-9]+)(.*)$ /forum-$1-1.html;
^/index\.asp\?boardid=([0-9]+)$ /forum-$1-1.html;
^/index\.asp$ /index.php;

So, what's the matter with rules listed in the list 2? and how could I make it woking.



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

More information about the nginx mailing list