我有这个重写规则:
<system.webServer>
<rewrite>
<rules>
<rule name="CanonicalHostNameRule1" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www\.domain\.no$" negate="true" />
</conditions>
<action type="Redirect" url="https://www.domain.no/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
我怀疑这有点错误,因为当我为非规范名称设置站点绑定时,它只会从
http://domain.no
重定向到 https://WWW.domain.no
。那么我想知道,为了从非规范 HTTP 重定向到规范 HTTPS,是否绝对有必要使用 SSL 设置网站的所有四个绑定?
即。
http://domain.no
、http://www.domain.no
以及规范的 httpS://domain.no
和 httpS://www.domain.no
。我的 DNS 服务器有这两个名称的记录,并且证书来自 LetsEncrypt。
事实证明,证书绑定(SSL 握手)先于 IIS 管道中的 URL 重写 2.1 引擎。因此,我自己的答案只是为了确认您确实需要为站点设置四个绑定。