nginx 0.7.65 rewrite url with querystring problem?
Posted
by WisdomFusion
on Stack Overflow
See other posts from Stack Overflow
or by WisdomFusion
Published on 2010-03-30T01:56:31Z
Indexed on
2010/03/30
2:03 UTC
Read the original article
Hit count: 262
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
© Stack Overflow or respective owner