Nginx - URL 跳转

 

1. 当访问 https://xxx.com/ccb/xxx/xxx.html 跳转到 https://www.baidu.com 返回 301 重定向。

location /ccb/ {
    return 301 https://www.baidu.com;
    proxy_pass http://192.168.118.14/;
    index  index.html index.htm;
}

 

2. 当访问 https://xxx.com/ccb/activity/xxx.html 跳转到 https://www.baidu.com 返回 302 重定向。

location /ccb/ {
    rewrite /ccb/activity(.*)$ https://www.baidu.com break;
    proxy_pass http://192.168.118.14/;
    index  index.html index.htm;
}

 

posted @ 2020-04-07 17:33  hukey  阅读(2241)  评论(0编辑  收藏  举报