IIS重定向HTTP至HTTPS

一、安装URL重写模块,自行百度下载

二、选择网站进行添加规则

三、总结
其实就是在站点的Web.config增加了一段配置:

<system.webServer>
        <rewrite>
            <rules>
                <rule name="http转https" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTPS}" pattern="off" />
                    </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" />
                </rule>
            </rules>
        </rewrite>
</system.webServer>

如果下一个站点也需要设置HTTP重定向HTTPS,直接在Web.config增加这段配置即可。

原文地址:https://www.cnblogs.com/dennisdong/p/14473541.html