[IIS] http 強制轉成https 方法
開啟網站應用程式根目錄下的 web.config 設定檔,並且找到 <system.webServer> 區段,加入以下設定即可完成:
<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>
IIS7 以上請安裝 URL Rewrite
https://www.iis.net/downloads/microsoft/url-rewrite
留言
張貼留言