2014-04-15 77 views
0

我有重定向的问题。
我有域名就像:
example.com

和几个子域像
application.example.com
documents.example.comIIS将通配符重定向到域的几个子域

很难做出一个通配符绑定,所以我想做URL重定向默认Web站点;) 如果有人犯错的URL地址,如:
doduments.example.com - 我想他重定向到example.com

这里的情况更compli cated,因为我需要做同样的事情,但对于另一个域:
example.pl
和子域
aplikacja.example.pl
dokumenty.example.pl

回答

0

我做了这样的事情;)

  <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> 

远非完美,但它的工作原理。 我无法在匹配网址中过滤域名 - 我不知道为什么;(