zoukankan      html  css  js  c++  java
  • IIS (安装SSL证书后) 实现 HTTP 自动跳转到 HTTPS

    IIS 里 安装好 SSL 证书后,如何实现 在浏览器里录入 http://www.xxx.com,会自动跳转到 https://www.xxx.com 呢。

    首先,下载并安装 IIS 扩展: URL重写(URL Rewrite)扩展

    URL重写扩展下载地址: https://www.iis.net/downloads/microsoft/url-rewrite

    其次,修改 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>

    最后,重启网站 或重启 IIS。在浏览器里录入:http://www.xxx.com,会自动跳转到 https://www.xxx.com

  • 相关阅读:
    记一次主从同步出现错误
    Mycat的学习
    MHA高可用集群
    MySQL进行 行累计
    设定从某个时间执行脚本,直到现在
    跟踪数据
    爬虫笔记
    爬虫练习
    css3-文本阴影
    vue生命周期
  • 原文地址:https://www.cnblogs.com/anjou/p/10249466.html
Copyright © 2011-2022 走看看