【问题标题】:convert iis rewrite to nginx将iis重写转换为nginx
【发布时间】:2014-10-15 18:52:21
【问题描述】:

刚接触 nginx,完全一头雾水。

如何将此 URL 重写转换为 nginx?

<rule name="Redirect1" stopProcessing="true">
    <match url="^(about-us|sites\/company.com|item1|item2|item3)/.*$" ignoreCase="false" />
    <action type="Redirect" redirectType="Permanent" url="https://backend.com/<which ever link they decide to click on>" />
</rule>

谢谢,我很感激!

【问题讨论】:

    标签: nginx iis-7 rewrite


    【解决方案1】:

    查看ngx_http_rewrite_module 文档。

    ngx_http_rewrite_module 模块用于使用正则表达式更改请求 URI、返回重定向和有条件地选择配置。

    来源:http://nginx.org/en/docs/http/ngx_http_rewrite_module.html

    【讨论】:

    • 谢谢谭!我已经阅读了这篇文章,但我仍然对如何将多个 URL 转换为重定向感到有些困惑。我可以一次重定向一个 URL,即。 location /about-us { rewrite ^ company2.com$request_uri redirect;} 那么我需要为每个 URL 执行此操作吗?或者我可以使用一个位置来重写多个 URL?再次感谢您!
    猜你喜欢
    • 2022-01-17
    • 2017-06-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-11
    • 1970-01-01
    • 2013-12-01
    相关资源
    最近更新 更多