【问题标题】:URL should hit https instead of httpURL 应该是 https 而不是 http
【发布时间】:2019-02-27 23:42:04
【问题描述】:

我正在运行一个 Windows Server,我在其中托管了一个网站。

现在我已经完成了与站点的 SSL 证书的绑定。但是每次我点击网站 URL 时,它都会转到 http 而不是 https。虽然我已经用 SSL 证书绑定了 http & https。

例子-

当我尝试访问 abc.com 时

it goes http://example.com

而不是

https://example.com

我需要做更多的事情来帮助我解决这个问题吗? 所以每次我尝试访问

example.com

我会去的

https://example.com

有没有人知道解决这个问题的方法!

【问题讨论】:

  • 你有很多方法来控制它,但首先,example.com 默认应该转到http://example.com,这是早期 HTTP 时代的规则。下面的答案显示了如何强制重定向到 HTTPS,您还可以查看 HSTS。

标签: ssl redirect iis https windows-server-2012-r2


【解决方案1】:

您需要添加重定向以确保所有流量都被重定向,如下所示。确保您已安装 URL 重写 module

<rule name="HTTPS force" enabled="true" stopProcessing="true">
  <match url="(.*)" />
  <conditions>
     <add input="{HTTPS}" pattern="^OFF$" />
  </conditions>
  <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
</rule>

【讨论】:

    猜你喜欢
    • 2013-02-28
    • 2011-05-03
    • 2018-08-30
    • 2013-01-26
    • 1970-01-01
    • 2017-05-19
    • 2019-12-19
    • 2022-01-21
    • 2023-04-01
    相关资源
    最近更新 更多