【问题标题】:redirect https://www to https:// through web.config通过 web.config 将 https://www 重定向到 https://
【发布时间】:2015-02-23 17:31:45
【问题描述】:

我想将任何内容重定向到https://domain.com
我找到了这段代码:

  <rewrite>
    <rules>
      <rule name="SecureRedirect" stopProcessing="true">
        <match url="^(.*)$" />
        <conditions>
          <add input="{HTTPS}" pattern="off" />
          <add input="{HTTP_HOST}" pattern="^(www\.)?(.*)$" />
        </conditions>
        <action type="Redirect" url="https://{C:2}" redirectType="Permanent" />
      </rule>
    </rules>
  </rewrite>

https://www.domain.com外,它的工作原理
我的虚拟服务器是带有 IIS 8 的 Windows Server 2012,域是 https://kajsystem.com

【问题讨论】:

    标签: redirect iis web web-config url-redirection


    【解决方案1】:

    我建议使用 IIS 8 配置,包括使用 URL 重写模块,它可以处理转发并保留整个请求的 URL。 MSDN 网站上有一篇相当全面的文章涵盖了这一点:

    MSDN redirect on IIS 7 and higher

    【讨论】:

      猜你喜欢
      • 2017-12-01
      • 2018-03-31
      • 2012-06-09
      • 2016-09-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-30
      相关资源
      最近更新 更多