http 强制跳转https

 

1.安装IIS UrlReWriter 模块

https://www.iis.net/downloads/microsoft/url-rewrite

2.web.config作如下配置

 

<rewrite>
<rules>
<rule name="http转https" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" />
</rule>
</rules>
</rewrite>

  

posted @ 2023-01-07 21:51  zhihua  阅读(133)  评论(0)    收藏  举报