繁体   English   中英

IIS7 https到http重定向不适用于www子域

[英]IIS7 https to http redirect not working on www subdomain

我试图在我们网站的所有页面上强制使用http,但结帐页面除外。 我使用了下面的重写规则,但不适用于网址中的www子域。

如果我使用https://domain.com,它将成功重定向到http://www.domain.com,但是如果我尝试将https与www结合使用,则不会发生任何情况。 请注意,还有一个规范的域名重定向,但是如果没有此规则,此问题仍然会发生。

<rule name="No-https" enabled="true" stopProcessing="true">
  <match url=".*" negate="false" />
  <action type="Redirect" url="http://{HTTP_HOST}{REQUEST_URI}" />
  <conditions>
    <add input="{HTTPS}" pattern="on" />
    <add input="{URL}" pattern="CheckOut" negate="true" />
  </conditions>
</rule>

这使我整个上午发疯,我希望对IIS重写有更多经验的人能对我有所帮助。

在类似问题上花费了几个小时。 在我的情况下,我将流量从http重定向到https,并且我想在使用子域的地方执行相同的操作,例如http://subdomain.mydomain.com重写为https://subdomain.mydomain.com 看来,对于IIS 7.5而言,至少您需要在IIS中为每个特定子域添加一个http绑定,否则它不会被下面的catch all matching捕获。

    <rewrite>
        <rules>
            <clear />
            <rule name="Redirect to https" stopProcessing="true">
                <match url="(.*)" />
                <conditions>
                    <add input="{HTTPS}" pattern="off" ignoreCase="true" />
                </conditions>
                <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
            </rule>
        </rules>
    </rewrite>

暂无
暂无

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

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