简体   繁体   English

删除所有GET参数以进行重定向

[英]Removing all GET parameters for redirect

I want to redirect the following url to homepage using nginx 我想使用Nginx将以下网址重定向到首页

https://www.example.com/old.php?u=BUH09MrRGtnYWB2Nc5CGcX879Y6wqF5EDTij6vphybUekhzY0Qo%3D&b=5

The url above should redirect to https://www.example.com/ 上面的网址应重定向到https://www.example.com/

I am using the following rule 我正在使用以下规则

rewrite ^/old.php(.*)$ https://www.example permanent;

The redirect to homepage works but i see the 重定向到首页的作品,但我看到了

https://www.example.com/?u=BUH09MrRGtnYWB2Nc5CGcX879Y6wqF5EDTij6vphybUekhzY0Qo%3D&b=5

Instead of https://www.example.com/ in address bar 而不是地址栏中的https://www.example.com/

according to http://wiki.nginx.org/HttpRewriteModule#rewrite , you just need to add a ? 根据http://wiki.nginx.org/HttpRewriteModule#rewrite ,您只需要添加一个? at the end of the rewrite: 重写结束时:

rewrite ^/old.php(.*)$ https://www.example? permanent;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM