Nginx rewrite rule not working?

You cannot match arguments in rewrite rules, they may include paths only. The reasons are simple: suppose arguments may have another order; suppose there can be additional arguments you did not take into account (e.g. Keywords from Google) So your rules should be rewritten in a way to match path at the first and then check arguments. Like this: rewrite ^/index_(0-9+)(.*)$ /forum-$1-1.

Html last; location /index. Asp { if ($arg_boardid ~ "^(0-9+)") { rewrite ^ /forum-$1-1. Html break; } rewrite ^ /index.

Php break; } location /dispbbs. Asp { rewrite ^ /thread-$arg_ID-1-1. Html break; }.

You cannot match arguments in rewrite rules, they may include paths only. The reasons are simple: suppose arguments may have another order; suppose there can be additional arguments you did not take into account (e.g. Keywords from Google). So your rules should be rewritten in a way to match path at the first and then check arguments.

Like this: rewrite ^/index_(0-9+)(.*)$ /forum-$1-1. Html last; location /index. Asp { if ($arg_boardid ~ "^(0-9+)") { rewrite ^ /forum-$1-1.

Html break; } rewrite ^ /index. Php break; } location /dispbbs. Asp { rewrite ^ /thread-$arg_ID-1-1.

Html break; }.

Thanks. But, I also have rules like rewrite ^/dispbbs_(0-9+)_(0-9+)\. Html$ /thread-$2-1-1.

Html last; in nginx. Config, they work perfect. I'll try out your seggestions.

:) – WisdomFusion Mar 29 '10 at 8:27 rewrite ^/dispbbs_(0-9+)_(0-9+)\. Html$ /thread-$2-1-1. Html last; – WisdomFusion Mar 29 '10 at 8:56 Arguments (query string) go after question character.

You can match anything before, because it's a string, but you can not do matches against query string. – Alexander Azarov Mar 29 '10 at 9:31 Should read "because it's a path" instead of "because it's a string". – Alexander Azarov Mar 29 '10 at 10:11 Thanks for your patient.

:) rewrite ^/dv_rss\. Asp(.*) /archiver/ last; However, this one works perfect. – WisdomFusion Mar 29 '10 at 10:23.

Rewrite ^/index_(0-9+)(.*)$ /forum-$1-1. I have try out rewrite rules above, and get a dead result, not working. I have refer to many posts and articles, and no help.

Is there any mistakes?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions