1. 当前位置:网站首页 > 网站运营

IIS7强制跳转https配置


一步一步太麻烦,直接上代码。网站根目录创建web.config文件,内容为:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <staticContent>
            <mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
            <mimeMap fileExtension=".woff2" mimeType="application/x-font-woff" />
        </staticContent>
        <rewrite>
            <rules>
                <rule name="https" patternSyntax="ECMAScript" stopProcessing="true">
                    <match url="(.*)" negate="false" />
                    <conditions logicalGrouping="MatchAny" trackAllCaptures="true">
                        <add input="{HTTPS}" pattern="^OFF$" />
                        <add input="{HTTPS_HOST}" pattern="^(localhost)" />
                    </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Temporary" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>
rewrite部分


本文最后更新于2018-12-15,已超过 3个月没有更新,如果文章内容或图片资源失效,请留言反馈,我们会及时处理,谢谢!
版权说明

本文地址:https://blog.gengchao.cn/post-239.html
未标注转载均为本站远程,转载请注明文章出处:

发表评论

联系我们

在线咨询:点击这里给我发消息

微信号:cngengchao

工作日:9:00-23:00,节假日休息

扫码关注