[英]nginx - How rewrite directive works on location matching together with flags?
[英]nginx location rewrite not matching
在我們的nginx配置中,我們定義了以下重寫以將請求轉發到另一個域:
location /service {
rewrite ^/service/(.*)$ https://newdomain.com/service/$1 redirect;
}
它與http://www.example.com/service/test123
之類的URL匹配,但以下URL不匹配:
https://www.example.com/service/imprint/acc/123456/ext_css/http://www3.example.com/formulare/css/service.css
是的,在/ ext_css /之后有第二個URL,我們現在不正確,但是目前無法更改它。
有沒有辦法將整個路徑完全轉發到新服務器?
/service/imprint/acc/123456/ext_css/http://www3.example.com/formulare/css/service.css
在定位塊之外執行此操作即可達到目的。
代替
location /service {
rewrite ^/service/(.*)$ https://newdomain.com/service/$1 redirect;
}
我們現在有
rewrite ^/service/(.*)$ https://newdomain.com/service/$1 redirect;
現在,它匹配/service/
之后編寫的所有內容
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.