【问题标题】:Redirect non WWW site to https:// IIS将非 WWW 站点重定向到 https:// IIS
【发布时间】:2020-12-09 23:59:25
【问题描述】:

我们有一个非 WWW 网站,我们想重定向到 https://

该站点托管在 IIS 上,我们希望只键入 websitename.domain.com 并将其重定向到 https:// 我们有一个 URL 重写规则,但是在键入 websitename.domain.com 时它,它甚至不会尝试转到 https:// 或 http:// 是否需要设置其他内容才能使其正常工作?

谢谢。

【问题讨论】:

  • 编辑问题以包含您的规则。

标签: http redirect iis https dns


【解决方案1】:

首先,请确保您使用 websitename.domain.com 为 HTTP 和 https 协议绑定站点绑定,如下所示:

尝试以下规则将 http 重定向到 https:

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

【讨论】:

    猜你喜欢
    • 2019-12-13
    • 2021-12-03
    • 2015-06-15
    • 1970-01-01
    • 2013-06-11
    • 1970-01-01
    • 2021-12-24
    • 2018-09-25
    • 1970-01-01
    相关资源
    最近更新 更多