IIS配置免费SSL及强制跳转HTTPS
IIS配置免费SSL及强制跳转HTTPS
本文是在腾讯云申请免费SSL证书,一年有效期。然后访问http后强制访问https。
申请SSL
- 首先注册活登录腾讯云,进入控制台,搜索找到SSL证书控制台。
- 点击我的证书,申请免费证书
- 目前只有亚洲诚信的,有效期一年,根据步骤操作即可。
IIS强制HPPTS访问
- 下载安装URL重写模块
- 在WebConfig中进行配置如下代码
<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>