Welcome! Log In Create A New Profile

Advanced

nginx 0.7.65 rewrite url with querystring problem?

March 29, 2010 09:51PM
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[code]
rewrite ^/index_([0-9]+)(.*)$ /forum-$1-1.html last;
rewrite ^/dispbbs_([0-9]+)_([0-9]+)\.html$ /thread-$2-1-1.html last;
[/code]
Those rules work perfect till now.

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

list 2[code]
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;
}
[/code]

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

list 3[code]
^/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;
[/code]

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

V/R,

gavin
Subject Author Posted

nginx 0.7.65 rewrite url with querystring problem?

WisdomFusion March 29, 2010 09:51PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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