把http://example.com/test.php?para=xxx?重定向到?http://example.com/new
若按照默认的写法:rewrite ^/test.php(.*) /new permanent;
重定向后的结果是:http://example.com/new?para=xxx
如果改写成:rewrite ^/test.php(.*) /new? permanent;
?
那结果就是:http://example.com/new
?
http://wiki.nginx.org/HttpRewriteModule
?
If in the line of replacement arguments are indicated, then the rest of the request arguments are appended to them. To avoid having them appended, place a question mark as the last character:
?
rewrite ^/users/(.*)$ /show?user=$1? last;