帮助中心 >  技术知识库 >  云服务器 >  服务器教程 >  IIS利用web.config文件设置https的301跳转

IIS利用web.config文件设置https的301跳转

2019-11-12 14:00:45 2109

将下列代码粘贴进站点根目录下的web.config文件里服的

<system.webServer>节点下保存即可


<rewrite>

    <rules> 

        <rule name="wwwRedirect" stopProcessing="true">

            <match url=".*" /> 

            <conditions>

                <add input="{HTTP_HOST}" pattern="^wu-168.cn$" />

            </conditions>

            <action type="Redirect" url="https://www.landui.com/{R:0}" redirectType="Permanent" />

        </rule>

        <rule name="HTTP to HTTPS redirect" stopProcessing="true">

            <match url="(.*)" />

            <conditions>

                <add input="{HTTPS}" pattern="off" ignoreCase="true" />

            </conditions>

            <action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}/{R:1}" />

        </rule>

    </rules>

</rewrite>


提交成功!非常感谢您的反馈,我们会继续努力做到更好!

这条文档是否有帮助解决问题?

非常抱歉未能帮助到您。为了给您提供更好的服务,我们很需要您进一步的反馈信息:

在文档使用中是否遇到以下问题: