nginx rewrite 匹配?问题
由于业务需要,将在nginx 前端做rewrite转向
现将/home/index.html?growingId=([0-9]+)$ 转向到 /people/([0-9]+)
本想直接使用 rewrite ^/home/index.html\?growingId=([0-9]+)$ /people/$1/ last; 可怎么也不行,可能是由于?匹配的问题吧。在网上找了下,用下面的方法搞定。
if ($query_string ~ "growingId=(.*)") {
set $growingId $1;
rewrite ^/home/index.html.* /people/$growingId/ last;
}
set $growingId $1;
rewrite ^/home/index.html.* /people/$growingId/ last;
}
转载于:https://blog.51cto.com/cqfish/301202