【问题标题】:IIS redirect wildcard few subdomain to domainIIS 将通配符几个子域重定向到域
【发布时间】:2014-05-29 09:10:04
【问题描述】:
我的重定向有问题。
我的域名如下:
example.com
和一些子域,如
application.example.com
文档.example.com
很难进行通配符绑定,所以我想在默认网站中进行 URL 重定向;)
如果有人在 URL 地址中出错,例如:
doduments.example.com - 我想将他重定向到 example.com
这里的情况更复杂,因为我需要做一些类似的事情,但是对于另一个域:
例子.pl
和子域
aplikacja.example.pl
dokumenty.example.pl
【问题讨论】:
标签:
iis
redirect
rewrite
iis-8
【解决方案1】:
我做了这样的事情;)
<rule name="*.example.pl" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTP_HOST}" pattern="example\.pl$" />
</conditions>
<action type="Redirect" url="http://example.pl/" />
</rule>
<rule name="*.example2.pl" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTP_HOST}" pattern="example2\.pl$" />
</conditions>
<action type="Redirect" url="http://example2.pl/" />
</rule>
远非完美,但它确实有效。
我将无法过滤匹配 url 中的域 - 我不知道为什么 ;(