[英]IIS CanonicalHostNameRule for different wrong subdomains
I currently have this CanonicalHostNameRule. 我目前有这个CanonicalHostNameRule。
We have multiple top-level domains (.ch and .de), that is why we don't use the default CanonicalHostNameRule from IIS. 我们有多个顶级域(.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>
This works for 这适用于
http://supertext.ch http://supertext.ch
But not for 但不是
http://holdrio.supertext.ch http://holdrio.supertext.ch
http://ww.w.supertext.ch http://ww.w.supertext.ch
http://www.mail.supertext.ch http://www.mail.supertext.ch
and I really would like something that redirects any subdomain to www.supertext.ch or .de respectively. 我真的很想将某些子域分别重定向到www.supertext.ch或.de。 Any ideas? 有任何想法吗?
You could use following pattern: ^(?!www\\.supertext\\.[de|ch])(\\S+)\\.(de|ch)$
您可以使用以下模式: ^(?!www\\.supertext\\.[de|ch])(\\S+)\\.(de|ch)$
The results would be for example: 结果将是例如:
holdrio.supertext.ch -> holdrio.supertext.ch->
holdrio.supertext.de-> holdrio.supertext.de->
supertext.ch-> 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>
Note: www.supertext.ch.supertext.ch is not covered 注意:不涵盖www.supertext.ch.supertext.ch
I hope this works for you. 希望这对您有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.