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

  • 相关阅读:
    Course Schedule II
    Vim笔记
    python programming
    暴风电视刷机教程
    python asyncio
    sqlalchemy lock and atomic
    rust学习(二)
    rust-vmm 学习(二)
    e3s10 网络管理
    打造VIM成为IDE - nerdtree
  • 原文地址:https://www.cnblogs.com/anjou/p/10249466.html
Copyright © 2011-2022 走看看