IIS7 IIS 7.5下http 做301重定向到https
我们的服务器部分是windows下的IIS平台,一些用户安装了SSL https证书后,不会控制301跳转,下面直接贴出代码,根据需要把代码放到web.config文件里即可。
http跳转到https
这个代码段是http重定向到https, 注意,要放在和之间。
<rule name="HTTP to HTTPS redirect" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTPS}" pattern="off" ignoreCase="true" /> </conditions> <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" /> </rule>
http跳转到https
提醒:里面的网址记得改成你自己的网站,别懒得只会copy!
这个代码段是无3w重定向到有3w域名, 注意,要放在和之间。
<rule name="www" stopProcessing="true"> <match url=".*" /> <conditions> <add input="{HTTP_HOST}" pattern="^domain\.com$" /> </conditions> <action type="Redirect" url="https://www.domain.com/{R:0}" /> </rule>
完整的web.config代码
下面代码包含了,无3w网址,跳转到有3w网址; 以及, http全部跳转到https
当然了,知道大家懒,已经将两份整合到一起,将下面全部代码保存成web.config文件,存放到空间的web目录下即可。再次提醒:里面的网址记得改成你自己的网站,别懒得只会copy!
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="www" stopProcessing="true"> <match url=".*" /> <conditions> <add input="{HTTP_HOST}" pattern="^domain\.com$" /> </conditions> <action type="Redirect" url="https://www.domain.com/{R:0}" /> </rule> <rule name="HTTP to HTTPS redirect" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTPS}" pattern="off" ignoreCase="true" /> </conditions> <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" /> </rule> </rules> </rewrite> </system.webServer> </configuration>
原文链接:https://www.ip110.com/faq/technique/1061.shtml
(资源库 www.zyku.net)
上一篇:Windows Process Activation Service (WAS) 服务无法启动
栏 目:IIS
下一篇:IIS上部署MVC网站,打开后ExtensionlessUrlHandler-Integrated-4.0解决方法
本文标题:IIS7 IIS 7.5下http 做301重定向到https
本文地址:https://www.zyku.net/iis/1844.html
您可能感兴趣的文章
- 05-11FastAdmin 在 IIS 环境下伪静态如何配置?
- 05-09IIS8 通过web.config 实现http跳转到https
- 05-09接口测试 Fiddler 抓取 https
- 04-17IE浏览器 https不能访问的解决方案
- 04-17IIS上部署MVC网站,打开后ExtensionlessUrlHandler-Inte
- 04-08完美快速解决百度分享不支持HTTPS的问题
- 04-02Apache下.htaccess重写URL 实现http自动跳转https的方
- 03-31Nginx的rewrite(地址重定向)解析
- 03-31nginx 目录路径重定向设置方法
- 03-30Windows下IIS安装SSL证书并自动续期
- 01-12三星fold2分屏功能在哪里设置
- 07-08华为nova8se活力版截图方法汇总
- 01-12邻通通-邻通通应用软件功能介绍
- 04-26vivox60pro指纹特效更改方法
- 09-19阿里Teambition网盘下线怎么转移数据
- 01-20红米手机自动锁屏时长怎么设置
- 09-20厚墨设置字体教程分享
- 02-20真我gt虚拟键隐藏教程
- 10-15华为耳机配对苹果手机教程介绍
- 04-01vivos9充电电池保护设置方法
最近更新
阅读排行
猜你喜欢
- 01-12习惯养成-习惯养成应用软件功能介绍
- 01-11蓝鸽智慧校园通-蓝鸽智慧校园通应用软
- 12-07真我手机如何唤醒语音助手
- 01-11春暖爱阅读课程-春暖爱阅读课程应用软
- 12-072022个人所得税专项附加扣除信息确认
- 01-13php导入文件夹图片保存到dedecms的方
- 09-20鸿蒙系统怎么设置默认音乐
- 01-11家居优惠券-家居优惠券应用软件功能介
- 12-14HTML <tfoot> 标签
- 01-12外景相机-外景相机应用软件功能介绍