017_nginx重定向需求

重定向的各种需求

需求一、

前端同事需要把特定的url进行重定向,实现如下:

location  / {
    root /data/base.apiportal_opsweb;
    index index.html index.htm;
    if ($request ~ product|api){          #url中包含product或api的都进行跳转
        rewrite /(.*) /index.html break;  #原始的请求url还在,但实际已经重定向到新的访问地址了
    }
}

需求二、

 

posted @ 2017-09-11 18:42  arun_yh  阅读(206)  评论(0编辑  收藏  举报