IIS7设置http跳转到https重定向的方法
配置好了https站点后,还需要设置301跳转,http站点跳转到https站点。先下载安装URL重写模块:Microsoft URL Rewrite Module
32位URL重写模块下载:http://download.microsoft.com/download/4/9/C/49CD28DB-4AA6-4A51-9437-AA001221F606/rewrite_x86_zh-CN.msi
64位URL重写模块:http://download.microsoft.com/download/4/E/7/4E7ECE9A-DF55-4F90-A354-B497072BDE0A/rewrite_x64_zh-CN.msi
下载对应的文件在服务器上安装好后,新建web.config文件,内容如下
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="HTTP to HTTPS redirect" 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>
</system.webServer>
</configuration>将web.config放在网站根目录后,重启IIS即可
TAG
- 在web.Config中配置asp.net 多个域名重定向
- https站点开启HSTS
- http跳转https和https跳转http的两种301重定向代码
- IIS网站打开提示您无权使用所提供的凭据查看此目录或页面的解决方法
- IIS10.0 Web平台安装程序无法安装URL重写工具
- Nginx网站开启SSL后将带www的域名和http协议的网址全部301跳转到不带www的https域名的方法
本文标题:《IIS7设置http跳转到https重定向的方法》
本文链接:https://zhangwenbao.com/iis7-set-http-to-https-redirect.html
