我有一个移动端的链接:
https://www.xxx.com/comparede...,2
在通过pc端没有对应的页面,所以在pc打开时需要重写成:
https://www.xxx.com/compare?id=1,2
但因为nginx没办法if嵌套,所以现在无法针对pc进行重写 ,求答案:
我的错误写法:未区分pc与移动
if ($request_uri ~* "^/compared/comdetail.html\?ids=(.*)$") {
set $myarg1 $1;
rewrite .* https://$host/compared.html?ids=$myarg1? permanent;
}