![](/img/trans.png)
[英]Different default documents for two subdomains that go against the same site IIS 7
[英]IIS CanonicalHostNameRule for different wrong subdomains
我目前有這個CanonicalHostNameRule。
我們有多個頂級域(.ch和.de),這就是為什么我們不使用IIS中默認的CanonicalHostNameRule的原因。
<rule name="RedirectToWWW" enabled="true" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^(?!www)(\S+)\.(de?|ch)$" />
</conditions>
<action type="Redirect" url="https://www.{C:0}/{R:0}" />
</rule>
這適用於
但不是
http://holdrio.supertext.ch
http://ww.w.supertext.ch
http://www.mail.supertext.ch
我真的很想將某些子域分別重定向到www.supertext.ch或.de。 有任何想法嗎?
您可以使用以下模式: ^(?!www\\.supertext\\.[de|ch])(\\S+)\\.(de|ch)$
結果將是例如:
holdrio.supertext.ch->
holdrio.supertext.de->
supertext.ch->
<rule name="RedirectToWWW" enabled="true" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^(?!www\.supertext\.[de|ch])(\S+)\.(de|ch)$" />
</conditions>
<action type="Redirect" url="https://www.supertext.{C:2}/{R:0}" appendQueryString="true" redirectType="Permanent"/>
</rule>
注意:不涵蓋www.supertext.ch.supertext.ch
希望這對您有用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.