http無(wú)法自動(dòng)跳轉(zhuǎn)https

syxtj 2022-6-29 1205

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

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

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

    正確的規(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ā)新帖