我想从
重定向 www.setup.com/view.php?id=213
到
www.setup.com/213
这是我的nginx重定向
location ^~ view.php {
if ($query_string ~ "^id=([0-9-]+)$"){
rewrite ^/view.php$ http://$server_name/%1? break;
}
}
由于某种原因,它附加
?id= to the url
所以它变成了
www.setup.com?id=213
如何删除
?id= from the url?
答案 0 :(得分:0)
使用:
location / {
rewrite ^/view.php$ /$arg_id? redirect;
}