【伺服器】iis http跳轉https
阿新 • • 發佈:2019-01-26
前言
自從安裝 iis + phpstudy + ssl的https證書後 ,在百度內百度了很多啊,都是很麻煩的步驟,今天給大家帶來一個非常簡單的 http 轉向https請求配置
web.config 配置伺服器
找到 iis 的伺服器檔案目錄,比如我的是:C:\inetpub\wwwroot 。然後找到 web.config 檔案,把下面的程式碼直接貼上進去,然後修改域名即可。
<?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域名" />
<!-- 比如:
<action type="Redirect" redirectType="Found" url="https://lolku.cn" />
-->
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>