IIS 网站 HTTP 转 HTTPS

256

网址重定向

为了当访问 http 链接时,跳转到对应的 https 链接,需要在iis配置文件中进行URL重定向,添加配置文件如下:

<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>