陈家粉儿 发表于 2021-10-25 13:22:09

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/ ... mation.aspx?id=7435

页: [1]
查看完整版本: windows服务器IIS强制http跳转https