第一步:下載證書,導入證書到IIS
https://help.aliyun.com/knowledge_detail/95502.html
站點綁定https
第二部:安裝URL重寫模塊
rewrite_amd64_zh-CN.msi
鏈接: https://pan.baidu.com/s/1KbzEoC21Hv1znhB5D5hfgA
提取碼: 83af
想要32位的自己去百度,這里不提供,笑哭!!!
安裝完成重啟IIS
第三步:選中你的站點后,雙擊進入URL重寫右鍵添加規則
其實這一步就是在站點的Web.config增加了一段配置:
<system.webServer> <rewrite> <rules> <rule name="http轉https" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTPS}" pattern="off" /> </conditions> <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" /> </rule> </rules> </rewrite> </system.webServer>
如果下一個站點也需要設置HTTP重定向HTTPS,直接在Web.config增加這段配置就行。