【发布时间】:2015-06-07 17:20:11
【问题描述】:
我想为我的域将非 www 和非 https 的 URL 重定向到 https://www,我实际上在 web.config 中有以下内容,可以将非 https 重定向到 https,但仍然允许访问 domain.com没有www,
<rewrite>
<rules>
<clear />
<rule name="Default to root" stopProcessing="true">
<match url="(.*)default.aspx" />
<action type="Redirect" url="{R:1}" />
</rule>
<rule name="Redirect to https" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
我有共享主机..
【问题讨论】:
-
www对你来说是必需的吗? -
是搜索引擎优化所必需的。 .. .
-
您需要添加第三条规则来分析主机名头和重定向。
-
@LexLi 在第三个 rool 上收到错误消息 此网页有重定向循环
-
发布您的第三条规则。