IIS设置网站为HTTPS并且将HTTP重定向到HTTPS
第一步:下载证书,导入证书到IIS
https://help.aliyun.com/knowledge_detail/95502.html
站点绑定https

第二部:安装URL重写模块
rewrite_amd64_zh-CN.msi
链接: https://pan.baidu.com/s/1KbzEoC21Hv1znhB5D5hfgA
提取码: 83af
想要32位的自己去百度,这里不提供,笑哭!!!
安装完成重启IIS

第三步:选中你的站点后,双击进入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增加这段配置就行。
 
                    
                 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号