http無法自動跳轉(zhuǎn)https

syxtj 2022-6-29 1066

導(dǎo)入SSL證書后,http 可以訪問 https也可以訪問 ,web.config文件也建了,但http 無法自動跳轉(zhuǎn) https

最新回復(fù) (1)
  • hws 2022-6-30
    引用 2

    您好,可能是你編寫的web.config規(guī)則不正規(guī),請核實

    正確的規(guī)則如下:

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <rewrite>
                <rules>                
                    <rule name="HTTP to HTTPS redirect" stopProcessing="true">
                        <match url="(.*)" />
                        <conditions>
                            <add input="{HTTPS}" pattern="off" ignoreCase="true" />
                        </conditions>
                        <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
                    </rule>
                </rules>
            </rewrite>
        </system.webServer>
    </configuration>


返回
發(fā)新帖