怎么高http跳转https跳转的代码

下面代码以本站网址zhangshao.shop为示例,请根据需要自行修改。修改后复制跳转代码,粘贴到站点根目录下web.config或新建web.config文件中。


<?xml version="1.0" encoding="UTF-8"?>

<configuration>

 <system.webServer>

        <rewrite>

            <rules>

               <rule name="301" stopProcessing="true">

                    <match url="^(.*)$" ignoreCase="false" ></match>

                    <conditions logicalGrouping="MatchAll">                       

                         <add input="{HTTP_FROM_HTTPS}" pattern="^on$" negate="true" ></add>  

                  </conditions>

                    <action type="Redirect" url="https://www.zhangshaobiji.cn/{R:1}" redirectType="Permanent" ></action>

               </rule>

            </rules>

        </rewrite>

    </system.webServer> 

</configuration>



是不是很简单

推荐文章
搜索
标签
«    2026年6月    »
1234567
891011121314
15161718192021
22232425262728
2930
网站分类
文章归档