最近帮一个顾客做网站,  需要HTTPS.  

之前接触的SSL certificate直接上传到plesk 上面勾选重定向即可.

在此先吐槽下godaddy 服务贵功能还少.

 

用代码从HTTP来重定向到HTTPS 代码如下

 

  <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="Permanent" url="https://{HTTP_HOST}/{R:1}" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>

 

只需要把以上代码放到web.config 里面的<configuration>里面即可代码重定向到HTTPS.

 

相关文章:

  • 2021-07-07
  • 2021-12-10
  • 2021-06-22
  • 2021-11-19
  • 2021-08-09
  • 2022-12-23
猜你喜欢
  • 2021-12-03
  • 2021-06-04
  • 2021-12-03
  • 2021-11-21
  • 2021-10-03
相关资源
相似解决方案