iis如何默认访问https

1306
2021/2/18 15:45:10
栏目: 编程语言
开发者测试专用服务器限时活动,0元免费领,库存有限,领完即止! 点击查看>>

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>


辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

推荐阅读: 安装配置IIS+MySQL+PHP环境的详细教程