如何为许多站点配置静态nginx重定向?

时间:2016-06-21 11:53:29

标签: redirect nginx

为许多网站配置了nginx主机。 现在我们希望允许用户配置重定向。他们看起来像:

/page/from.html /page/to.thml
... ...

是否可以说nginx查看网站的指定文件并在请求匹配时进行重定向?

UPD

更好的解决方案是不需要重新启动nginx

1 个答案:

答案 0 :(得分:0)

您可以在nginx默认配置文件中添加此配置:

map $old_uri $redirects {
    example.com/def   example.com/abc;
    example.com/def   example.com/abc;
}

Link

相关问题