IIS 配置Http重定向到Https

注意首先要安装url重定向模块
然后在web.config末尾添加如下代码
 <system.webServer>
  <rewrite>
   <rules>
    <rule name="HTTP to HTTPS redirect" stopProcessing="true">
     <match url="(.*)" />
     <conditions>
      <add input="{HTTPS}" pattern="off" ignoreCase="true" />
     </conditions>
     <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
    </rule>
   </rules>
  </rewrite>
    </system.webServer>
原文地址:https://www.cnblogs.com/wangchaozhi/p/5536889.html