[英]IIS URL rewrite from multiple domains to non-www
I currently have below domains: 我目前有以下域名:
mydomain.com.au
mydomain.com.sg
mydomain.com.hk
I would like to redirect each of them to non-www. 我想将他们每个重定向到非www。 so eg. 所以例如
www.mydomain.com.au -> mydomain.com.au
www.mydomain.com.sg -> mydomain.com.sg
Any ideas? 有任何想法吗? Can I do this in one regex of do I need multiple for each domain extensions? 我可以在一个正则表达式中做到这一点吗?每个域名扩展都需要多个吗?
You can add this to your web.config
file inside the <system.webServer>
node. 您可以将其添加到<system.webServer>
节点内的web.config
文件中。 Just make sure that URL Rewrite module is installed. 只要确保安装了URL Rewrite模块即可。
<rule name="Remove WWW" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" />
<conditions>
<add input="{CACHE_URL}" pattern="*://www.*" negate="true" ignoreCase="true" />
</conditions>
<action type="Redirect" url="{C:1}://{C:2}" redirectType="Permanent" />
</rule>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.