万户网络知识库 > 常见问题 > IIS 设置HTTP强制跳转https
IIS 设置HTTP强制跳转https
更新时间:2026-01-20 14:20:40 访问量:
首先,确保你的IIS服务器上安装了URL重写模块。如果没有先安装URL重写模块
通过web.config文件实现重定向的XML配置,将以下代码复制到
system.webServer模块内
<rewrite>
<rules>
<!--http转https-->
<rule name="Redirect to https" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}:443/{R:1}" redirectType="SeeOther" />
</rule>
</rules>
</rewrite>