繁体   English   中英

IIS 8.5如何重定向http:// www。 到https:// www。 状态代码为301?

[英]IIS 8.5 How to redirect http://www. to https://www. with status code 301?

如何重定向http:// www https:// www 有状态代码301而没有代码302?

您将需要在web.config中添加URL重定向代码,并将重定向类型设为永久(301)

<system.webServer>
        <rewrite>
            <rules>
                <clear />
                <rule name="Redirect to https" stopProcessing="true">
                    <match url=".*" />
                    <conditions>
                        <add input="{HTTPS}" pattern="off" ignoreCase="true" />
                    </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>

将其添加到web.config中的配置标签下

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM