准备工作:

  1. 下载URL重写并安装:http://www.microsoft.com/zh-cn/download/details.aspx?id=7435

  2. website绑定443和80;

  3. 在web.config文件中添加
    <system.webServe>    
            <rewrite>
                <rules>
                    <rule name="HTTP to HTTPS" stopProcessing="true">
                        <match url="(.*)" />
                        <conditions>
                            <add input="{HTTPS}" pattern="off" />
                        </conditions>
                        <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Temporary" />
                    </rule>
                </rules>
            </rewrite>
    </system.webServer>

4.设置URL重写并应用

HTTP TO HTTPS_HTTP TO HTTPS

HTTP TO HTTPS_HTTP TO HTTPS_02

HTTP TO HTTPS_HTTP TO HTTPS_03

5.重启IIS服务,测试。



注:工作需要,参考网上博客,手写此文档,日后做学习使用。