# Nginx 0.7.65 rewrite url with querystring problem?

**URL:** <https://www.ruby-forum.com/t/nginx-0-7-65-rewrite-url-with-querystring-problem/185981>\
**Category:** NGINX\
**Created:** [March 30, 2010, 3:52am UTC](https://www.ruby-forum.com/t/nginx-0-7-65-rewrite-url-with-querystring-problem/185981 "2010-03-30T03:52:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![WisdomFusion](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/898d66/32.png) [@WisdomFusion](https://www.ruby-forum.com/u/WisdomFusion)\
**Post date:** [March 30, 2010, 3:52am UTC](https://www.ruby-forum.com/t/nginx-0-7-65-rewrite-url-with-querystring-problem/185981/1 "2010-03-30T03:52:14Z")

</div>

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.

V/R,

gavin

Posted at Nginx Forum:

> **[nginx 0.7.65 rewrite url with querystring problem?](https://forum.nginx.org/read.php?2,69281,69281#msg-69281)**
>
> 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...
