Web.config 301 设置http跳转https

2021-09-28 09:12:06 3019

RewriteEngine On

 

RewriteCond %{HTTPS} !=on

 

RewriteRule ^(.*) https://%{SERVER_NAME}/$1 [R,L]

 

<rewrite>

            <rules>

                <rule name="http redirect to https" stopProcessing="true">

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

                    <conditions>

                        <add input="{HTTPS}" pattern="^OFF$" />

                        <add input="{HTTPS_HOST}" pattern="^(localhost)" negate="true" />

                    </conditions>

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

                </rule>

            </rules>

        </rewrite>


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

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

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

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