iis7的http跳轉(zhuǎn)到https
部分安裝了https的香港虛擬主機(jī)用戶(hù),需要http自動(dòng)跳轉(zhuǎn)到https,這是可以實(shí)現(xiàn)的。
iis7的跳轉(zhuǎn)是通過(guò)web.config文件進(jìn)行的,您將以下代碼存成web.config文件,放到web目錄下即可實(shí)現(xiàn),代碼如下:
<?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>