相关疑难解决方法(0)

删除nginx重写中的参数

我重新启动后在nginx中重写URL.在旧网站中,我在URL中有查询参数来过滤内容,例如

http://www.example.com/mypage.php?type=4
Run Code Online (Sandbox Code Playgroud)

新页面没有这些参数.我想删除它们并将URL重写到主页面,以便我得到:

http://www.example.com/mypage/
Run Code Online (Sandbox Code Playgroud)

我在nginx中的重写规则是:

location ^~ /mypage.php {
    rewrite ^/mypage.php$ http://www.example.com/mypage permanent;
}
Run Code Online (Sandbox Code Playgroud)

但是使用此规则,参数仍会附加.我认为这$会阻止nginx处理更多的价值......任何想法?所有其他问题都涉及如何添加参数 - 我只想删除我的:)

rewrite get nginx

19
推荐指数
4
解决办法
4万
查看次数

标签 统计

get ×1

nginx ×1

rewrite ×1