windows服务器IIS强制http跳转https

windows服务器IIS强制http跳转https

在根目录找到web.config之后直接复制下面的重定向代码进去即可

<?xml version="1.0" encoding="UTF-8"?>
 
<configuration>
 <system.webServer>
 <rewrite>
 <rules>
 <rule name="http redirect to https" stopProcessing="true">
 <match url="(.*)" />
 <conditions>
 <add input="{HTTPS}" pattern="^OFF[ DISCUZ_CODE_0 ]quot; />
 <add input="{HTTPS_HOST}" pattern="^(localhost)" negate="true" />
 </conditions>
 <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" />
 </rule>
 </rules>
 </rewrite>
 </system.webServer>
</configuration>

如果您的服务器配置了web.config没有生效
请查看您是否有安装URL重定向工具
如果还没有安装
请传送到微软官网下载安装

https://www.microsoft.com/zh-cn/download/confirmation.aspx?id=7435

川公网安备 51019002001185号