簡體   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