请帮助我创建nginx重定向,如下所示:
https://mypage.com?via=181696076 -> https://newpage.com/checkout/?cc=GS950N&short_id=gi&via=181696076
参数(181696076(将发生变化,仅为一个数字,长度不固定我可以使用位置吗?
rewrite ^/(.*)$ https://newpage.com/checkout/?cc=GS950N&short_id=gi&$1;
我尝试了一些组合,但它对我不起作用——就像在服务器级上重写一样
感谢
我为这个问题找到了这样的解决方案:
location ~ ^/(.*)$ {
return 301 https://newpage.com/checkout/?cc=GK960N&short_id=gi&via=$1;
}