IIS rewrite 强制 http 導向https
只需要在網站設置中,「配置文件」配置一下就行了
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="HTTP to HTTPS redirect" stopProcessing="true"> <match url="(.*)" ></match> <conditions> <add input="{HTTPS}" pattern="^OFF$" ></add> </conditions> <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" ></action> </rule> </rules> </rewrite> </system.webServer> </configuration>