導入SSL證書后,http 可以訪問 https也可以訪問 ,web.config文件也建了,但http 無法自動跳轉 https
您好,可能是你編寫的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>