新建或者打开web.config文件,写入下面代码,然后上传到web目录下,就可以实现强制https

<?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>
最后修改:2022 年 12 月 29 日
不会真的有人要赞赏吧(大雾)