iis url重写实现http 重定向到 https

原文链接 http://www.360doc.com/content/21/0915/21/67180130_995651104.shtml

1.在iis上安装 url重写组件

2. 修改web.config 文件

在system.webServer节点中添加rewrite节点

<configuration>
<system.webServer>

<rewrite>
<rules>
<rule name="http2https" stopProcessing="true">
<match url="(.*)" />
<action type="Redirect" url="https://{HTTP_HOST}{R1}" logRewrittenUrl="true" redirectType="SeeOther" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
<add input="{HTTP_HOST}" pattern="^(localhost)" negate="true" />
</conditions>
</rule>
</rules>
</rewrite>

<system.webServer>
</configuration>

  

 

posted @ 2022-06-13 09:57  虹色流星雨  阅读(79)  评论(0编辑  收藏  举报