繁体   English   中英

IIS HTTPS无限重定向

[英]IIS HTTPS infinite redirect

我的webconfig中的HTTPS重定向配置有问题:

<rewrite>
    <rules>
        <rule name="Redirect to HTTPS" stopProcessing="true">
          <match url="(.*)" />
          <conditions>
            <add input="{HTTP_HOST}" pattern="^domain\.be$" negate="true" />
            <add input="{HTTPS}" pattern="OFF" ignoreCase="true" />
          </conditions>
          <action type="Redirect" url="http://www.domain.be/{R:1}" />
        </rule>
        <rule name="Redirect to WWW" stopProcessing="true">
          <match url=".*" />
          <conditions logicalGrouping="MatchAny">
            <add input="{HTTP_HOST}" pattern="^domain\.be$" />
          </conditions>
          <action type="Redirect" url="https://www.domain.be/{R:0}" redirectType="Permanent" />
        </rule>
  </rules>
</rewrite>

以下代码适用于:

但不适用于:

  • www.domain.be

每次访问该URL时,总是会遇到无限重定向错误。

谁能在我的web.config中指出我的错误?

提前致谢

此规则可用于将不是HTTPS也不是www.domain.be的所有内容发送到https://www.domain.be/

<rewrite>
    <rules>
        <rule name="redirect to https www" stopProcessing="true">
          <match url="(.*)" />
          <conditions logicalGrouping="MatchAny">
            <add input="{HTTP_HOST}" pattern="^www\.domain\.be$" negate="true" />
            <add input="{HTTPS}" pattern="ON" ignoreCase="true" negate="true" />
          </conditions>
          <action type="Redirect" url="https://www.domain.be/{R:0}" />
        </rule>
    </rules>
</rewrite>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM