【问题标题】:IIS with several bindings i need redirect one to HTTPS具有多个绑定的 IIS 我需要将一个重定向到 HTTPS
【发布时间】:2021-11-21 08:31:52
【问题描述】:

我们有一个包含多个绑定/域的网站。我需要将其中一个重定向到 HTTPS。我尝试了一些 URL 重写规则,但它不起作用:

rule name="HTTPS Redirect" stopProcessing="true">
                             <match url="^www.domain.com$" />
                             <conditions>
                                 <add input="{HTTPS}" pattern="^OFF$" />
                             </conditions>
                             <action type="Redirect" url="https://{HTTP_HOST}/{REQUEST_URI}" />
                         </rule>

rule name="HTTPS Redirect" stopProcessing="true">
                             <match url="(.*)" />
                             <conditions>
                                 <add input="{HTTP_HOST}" pattern="^www.domain.com$" />
                             </conditions>
                             <action type="Redirect" url="https:www.domain.com" />
                         </rule>

而且不起作用。

有什么建议吗? 谢谢,

【问题讨论】:

    标签: url iis url-rewriting


    【解决方案1】:

    尝试将这两条规则结合起来。

    rule name="HTTPS Redirect" stopProcessing="true">
             <match url="(.*)" />
             <conditions>
               <add input="{HTTP_HOST}" pattern="^www.domain.com$"/>
               <add input="{HTTPS}" pattern="^OFF$" />
             </conditions>
              <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" />
     </rule>
    

    【讨论】:

    • 它有效,谢谢 ;)
    • 您可以标记它以帮助其他有相同问题的人。
    • 我不能,我没有他的声誉水平
    猜你喜欢
    • 2015-02-13
    • 2015-04-11
    • 1970-01-01
    • 2020-02-12
    • 1970-01-01
    • 2014-01-25
    • 1970-01-01
    • 2014-01-12
    • 2011-03-15
    相关资源
    最近更新 更多