【问题标题】:Redirect HTTP to HTTPS won't work (with URL Rewrite)将 HTTP 重定向到 HTTPS 不起作用(使用 URL 重写)
【发布时间】:2019-05-23 04:59:28
【问题描述】:

我尝试让 http 自动重定向到 https。

我完全按照这些步骤操作:https://www.namecheap.com/support/knowledgebase/article.aspx/9953/38/iis-redirect-http-to-https

这是我的 web.config:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="SSL Redirect" enabled="true" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTPS}" pattern="^OFF$" />
                    </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent"/>
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

我在访问网站时遇到的错误是 ERR_TOO_MANY_REDIRECTS

【问题讨论】:

    标签: windows iis url-rewriting


    【解决方案1】:

    如果您使用 Cloudflare,我找到了一个可行的解决方案

    在 cloudflare 上,您只需选择“自动 HTTPS 重写”即可。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-08-10
    • 1970-01-01
    • 2014-03-10
    • 2018-06-11
    • 2015-07-28
    • 2014-08-14
    • 1970-01-01
    • 2017-11-19
    相关资源
    最近更新 更多