< 返回新闻公告列表

IIS http重定向https,强制用户使用https访问的配置方法

发布时间:2022/9/28

新建立一个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>