【问题标题】:web.config Redirect rule not working in IE and FireFoxweb.config 重定向规则在 IE 和 FireFox 中不起作用
【发布时间】:2020-11-16 08:54:05
【问题描述】:

我有两个域 baddomain.comgooddomain.com 指向同一个托管服务。我已经购买了 SSL 证书,现在我想将坏的证书重定向到安装了 SSL 的好证书。我编写了这些规则,它适用于 Chrome,但不适用于 IE 和 firefox。坏域重定向到 https 而不是重定向到好域。谢谢。

 <!--Redirect from bad domain to good one-->
<rule name="BadtoGood" patternSyntax="Wildcard" stopProcessing="true">
    <match url="*" />
    <conditions logicalGrouping="MatchAll">
        <add input="{HTTP_HOST}" pattern="baddomain.com" />
    </conditions>
    <action type="Redirect" url="https://gooddomain.com/{R:0}" redirectType="Permanent" />
</rule>             

<!--Force https on good domain -->
<rule name="forceHTTPS" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
    <match url="*" negate="false" />
    <conditions logicalGrouping="MatchAll">
        <add input="{HTTPS}" pattern="off" />
        <add input="{HTTP_HOST}" pattern="localhost" negate="true" />
    </conditions>
    <action type="Redirect" url="https://gooddomain.com/{R:0}" redirectType="Permanent" />
</rule>

【问题讨论】:

    标签: url-rewriting web-config


    【解决方案1】:

    原因是我通过网站控制面板启用了force https,它覆盖了web.config中的下游设置。

    在我的例子中,这是路径:

    Plesk for windows > 网站和域 > 主机设置

    【讨论】:

      猜你喜欢
      • 2020-03-30
      • 2016-03-25
      • 1970-01-01
      • 2015-01-26
      • 2019-08-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多