IIS Http自动跳转Https

1.安装SSL证书

免费申请:

  a. https://letsencrypt.osfipin.com

  b. 阿里云

  c. https://freessl.cn/ssltools

2.安装UrlRewrite扩展

 

 

3.Web.Config配置
打开项目的Web.Config配置文件,在<system.webServer>中,配置如下重定向代码:

<rewrite>
<rules>
<rule name="xinxin" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>

posted @ 2022-10-20 23:02  zhihua  阅读(289)  评论(0)    收藏  举报