前言
自从安装 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>