Nginx Rewrite 去掉重定向的参数 博客分类: nginx nginxrewrite
程序员文章站
2024-02-28 22:53:40
...
把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: