【发布时间】:2018-08-26 05:27:04
【问题描述】:
我正在将我所有网站的非 www 版本的域重定向到 www 版本。
但是,副作用是它还使用 www 重定向子域
例如api.example.com 到 www.api.example.com
这不是我想要的。我需要所有带有子域的网站都不要添加 www。
这是我目前的规则:
<system.webServer>
<rewrite>
<globalRules>
<clear />
<rule name="non-www to www" enabled="true" stopProcessing="false">
<match url=".*" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{CACHE_URL}" pattern="^(.+)://(?!www)(.*)" />
</conditions>
<action type="Redirect" url="{C:1}://www.{C:2}" />
</rule>
<rule name="http to https" stopProcessing="true">
<match url="(.*)" /> <!-- Require SSL must be OFF in the site settings -->
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}{REQUEST_URI}" />
</rule>
</globalRules>
</rewrite>
</system.webServer>
如果输入不以“www”开头并且它不是子域,是否可以制定仅重定向到 www.example.com 的规则?
任何带有子域的东西都不能在 www
请帮忙,因为我已经尝试了两天没有成功。
提前谢谢你!!
【问题讨论】:
标签: iis subdomain iis-7.5 iis-8 url-rewrite-module