强制跳https

在Web.config中

新增代码

  <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>内,<handlers>下边

 

posted @ 2023-10-20 14:57  小易儿  阅读(28)  评论(0)    收藏  举报