当前位置: 移动技术网 > IT编程>数据库>Redis > IIS7 IIS8 http自动跳转到HTTPS(80端口跳转443端口)

IIS7 IIS8 http自动跳转到HTTPS(80端口跳转443端口)

2020年08月17日  | 移动技术网IT编程  | 我要评论
iis7需要先确认是否安装 “url rewrite2 ” 伪静态模块 , 如果您已经安装可以跳过url rewirte (伪静态模块)下载地址 : 第一步: 选择站点, “url 重写”,如果安装的

iis7需要先确认是否安装 “url rewrite2 ” 伪静态模块 , 如果您已经安装可以跳过

url rewirte (伪静态模块)

下载地址 :

第一步: 选择站点, “url 重写”,如果安装的是英文版的 应该是【url rewrite】

第二步: 添加 “ 空白规则”

第三步:添加规则

名称 : https

匹配url 模式: (.*)

添加条件: 条件: {https} 模式: off

操作类型选择:重定向

重定向url: https://{http_host}/{r:1}

然后保存即可

最后效果图

条件中的逻辑分组处理

首先参考上图中的逻辑分组信息。

输入 类型 模式 是否忽略大小写 备注
{https} 与模式匹配 ^off$ yes 此项用来匹配你的请求是https还是http
{https_host} 与模式不匹配 ^(localhost) yes 如果你是本地的localhost不会重定向到ssl

高级版(直接把伪静态添加到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>

到此这篇关于iis7 iis8 http自动跳转到https(80端口跳转443端口)的文章就介绍到这了,更多相关http自动跳转到https内容请搜索移动技术网以前的文章或继续浏览下面的相关文章希望大家以后多多支持移动技术网!

如您对本文有疑问或者有任何想说的,请 点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网