NGINX上下文重定向

时间:2017-01-05 06:27:33

标签: nginx

  

我想将我的NGINX请求重定向到不同的上下文但是我   希望我的请求URL显示给用户remian相同。例如: -

     

如果用户输入https://example.com/test,则应重定向到   https://example.com/test1但是向用户显示的网址应保持不变,即   https://example.com/test

     

我尝试使用以下配置,但它会更改我的请求网址。

location /test {
                                 return 301 $scheme://$host/token/;
                                 $remote_addr;
                                  }

1 个答案:

答案 0 :(得分:1)

然后使用MPI Number of processors?模块,

location /test {
 rewrite ^ $scheme://$host/token/ permanent; # permanent if needed
}

如果您想通过应用程序控制重定向,请使用rewrite