编写了一个nginx重写规则,但是当我实现它时,它不能正常工作。
网站1:
# "best" added // $rewrited_best_added
"~/(?<rewrited_best_added>widget1|widget2)/$" "/best-$rewrited_best_added/";
在服务器块中:
if ($rewrited_request_uri != "") {
rewrite ^(.*)$ https://website2.com$rewrited_request_uri permanent;
}
预期结果是:https://website1.com/widget1/转到https://website2.com/best-widget1/
但是,它改为(字面意思)
https://website2.com/best- $ rewrited_best_added /
谁能告诉我这里是什么错误?感谢您的帮助!