你的位置:首页 > 互联网IT
http转https,http跳转https,http自动跳转https,http变https,IIS7 http自动跳转到https(通过编辑Web.config实现)
系统:Windows
功能:http跳转https
相同文章:https://m.012.ooo/?id=257
用法:Web.config 放入网站根目录
1.下载安装URL重写模块:Microsoft URL Rewrite Module
2.SSL设置不要勾选(很重要)
3.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>
第二种:
<?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$" />
<add input="{HTTPS_HOST}" pattern="^(localhost)" negate="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
文章转载:https://www.cnblogs.com/xiaohi/p/8038042.html
本文摘自:https://www.cnblogs.com/wxbug/p/7054972.html
发表评论: