IIS7和IIS8下的http自动跳转到HTTPS教程


前言

https域名证书的好处不言而喻,对收录好,安全加密,提升信任度

但不少windows服务器用户,在IIS下安装SSL证书后,苦恼访问http怎么可以自动跳去https下面呢?

本文将为您讲解如何设置http跳转到https
iis7的https的跳转

跳转前提:安装伪静态模块

这模块是微软官方提供的,需要另行安装,下面是安装地址

下载地址(64位):http://www.microsoft.com/zh-cn/download/details.aspx?id=7435
下载地址(32位):http://www.microsoft.com/zh-cn/download/details.aspx?id=5747

跳转脚本

您用txt记事本软件,把下面的脚本代码,复制粘贴进去后,保存成web.config格式文件,然后传到您网站的根目录下,即可完成跳转了,是不是很简单呢?

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<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>
</configuration>
免备案空间专题