http转https,http跳转https,http自动跳转https,http变https,IIS7 http自动跳转到https(通过编辑Web.config实现)

http转https,http跳转https,http自动跳转https,http变https,IIS7 http自动跳转到https(通过编辑Web.config实现)

系统:Windows

功能:http跳转https

相同文章:https://www.zhuguodong.com/?id=257

用法:Web.config 放入网站根目录

1.下载安装URL重写模块:Microsoft URL Rewrite Module


32位:http://download.microsoft.com/download/4/9/C/49CD28DB-4AA6-4A51-9437-AA001221F606/rewrite_x86_zh-CN.msi


64位:http://download.microsoft.com/download/4/E/7/4E7ECE9A-DF55-4F90-A354-B497072BDE0A/rewrite_x64_zh-CN.msi


2.SSL设置不要勾选(很重要)

QQ截图20220327234452.jpg

3.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" ignoreCase="true" />

         </conditions>

         <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />

       </rule>

     </rules>

   </rewrite>

</system.webServer>

</configuration>


第二种:

<?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$" />

                        <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>

</configuration>


文章转载:https://www.cnblogs.com/xiaohi/p/8038042.html

本文摘自:https://www.cnblogs.com/wxbug/p/7054972.html


admin

暂无介绍....

评论(0):

发表评论:

延伸阅读:

gost反向代理隧道,内网穿透,反向代理,隧道代理,端口转发

gost反向代理隧道,内网穿透,反向代理,隧道代理,端口转发系统:CentOS Stream,CentOS 9,Cent…

admin
2026-11-15

推荐一键清理CentOS系统磁盘空间,清理内存,清理缓存,清理磁盘,清理垃圾,清理硬盘,一键清理系统缓存,日记,不必要的内容,容器日记缓存,等系统缓存日记

推荐一键清理CentOS系统磁盘空间,清理内存,清理缓存,清理磁盘,清理垃圾,清理硬盘,一键清理系统缓存,日记,不必要的…

admin
2026-11-14

一键清理CentOS系统磁盘空间,清理缓存,清理磁盘,清理垃圾,清理内存,清理硬盘,一键清理系统缓存,日记,不必要的内容,容器日记缓存,等系统缓存日记

一键清理CentOS系统磁盘空间,清理缓存,清理磁盘,清理垃圾,清理内存,清理硬盘,一键清理系统缓存,日记,不必要的内容…

admin
2026-11-13

CentOS设置虚拟内存,虚拟内存设置,CentOS 7.9怎么设置虚拟内存2G,CentOS内存不足死机优化教程,虚拟内存压缩设置

CentOS设置虚拟内存,虚拟内存设置,CentOS 7.9怎么设置虚拟内存2G,CentOS内存不足死机优化教程,虚拟…

admin
2026-11-12

CentOS设置虚拟内存,虚拟内存设置,CentOS 7.9怎么设置虚拟内存2G

CentOS设置虚拟内存,虚拟内存设置,,CentOS 7.9怎么设置虚拟内存2G系统:CentOS Stream,Ce…

admin
2026-11-11