子域不能使用规范重写

我为我的Web应用程序configuration了通配符子域映射。 我已经在这个DNS设置中更改了“A”logging。 对这些新的子域的所有请求都正常工作。

Ex: http://test1.foo.com, test2.foo.com 

后来我configuration了IIS7 Canonical重写,如下所示:

 <rewrite> <rules> <rule name="Enforce canonical hostname" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTP_HOST}" negate="true" pattern="^www\.foo\.com$" /> </conditions> <action type="Redirect" url="http://www.foo.com/{R:1}" redirectType="Permanent" /> </rule> </rules> </rewrite> 

添加上面的代码后,所有的通配符子域都路由到http://www.foo.com 。

我希望所有的子域都能解决任何应用规范重写的问题。

请帮帮我。

这个问题有点老,但看看这是否有助于子域问题。 我没有testing过,但我相信它应该做你需要的。

 <rewrite> <rules> <rule name="Enforce canonical hostname - save subdomains" stopProcessing="true"> <match url=".?" ignoreCase="false" /> <conditions> <add input="{HTTP_HOST}" pattern="^([az.]+\.)?foo\.com$" /> <add input="{HTTP_HOST}" pattern="^www\." negate="true" /> </conditions> <action type="Redirect" redirectType="Permanent" url="http://www.{C:1}foo.com{URL}" /> </rule> </rules> </rewrite>