Nginx重写去掉后面的参数
0
我本来以为自己能搞定,太高估自己了,最后还是百度出来了。
把http://www.acgist.com/article?type=anime
重定向到http://www.acgist.com/article
若按照默认的写法:rewrite (.*) /article permanent;
重定向后的结果是:http://www.acgist.com/article?type=anime
如果改写成:rewrite (.*) /article? permanent;
那结果就是:http://www.acgist.com/article
注意上面的?
,简直精髓。