温馨提示×

iis如何默认访问https

九三
400
2021-02-18 15:45:10
栏目: 编程语言

iis如何默认访问https

在iis中设置默认访问https的方法

1.首先,在计算机中使用组合键“win+R”运行“Inetmgr”,打开iis管理器;

2.进入到iis管理器页面后,在页面中选择对应的站点;

3.在站点右侧菜单栏中,选择“URL重写”模块,并双击打开,添加规则;

4.最后,规则添加好后,在Web.config文件中添加以下配置即可;

<system.webServer>
<rewrite>
<rules>
<rule name="redirect to https" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
<add input="{HTTPS_HOST}" pattern="^(localhost)" negate="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" />
</rule>
</rules>
</rewrite>
</system.webServer>


0