I want to redirect the following url to homepage using nginx
https://www.example.com/old.php?u=BUH09MrRGtnYWB2Nc5CGcX879Y6wqF5EDTij6vphybUekhzY0Qo%3D&b=5
The url above should redirect to 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
according to http://wiki.nginx.org/HttpRewriteModule#rewrite , you just need to add a ? at the end of the rewrite:
rewrite ^/old.php(.*)$ https://www.example? permanent;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.