Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net IIS HTTPS无限重定向_.net_Redirect_Iis_Https - Fatal编程技术网

.net IIS HTTPS无限重定向

.net IIS HTTPS无限重定向,.net,redirect,iis,https,.net,Redirect,Iis,Https,我的网络配置中的HTTPS重定向配置有问题: <rewrite> <rules> <rule name="Redirect to HTTPS" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTP_HOST}" pattern="^domain\.b

我的网络配置中的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>


  • domain.be
  • 但不适用于:

    • www.domain.be
    当我转到那个URL时,总是会出现无限的重定向错误

    有人能指出我在web.config中的错误吗


    提前感谢

    此规则可用于将非HTTPS和非www.domain.be的所有内容发送到

    
    
    您可能需要检查说明如何在IIS中测试重写规则的内容。我也可以看到一个矛盾;你说重定向到HTTPS,但重定向到HTTP。
    <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>