Redirect www subdomain to root domain using Intelligencia.UrlRewriter
How can I configure Intelligencia.UrlRewriter in my ASP.NET web.config file to re开发者_运维知识库direct all http://www.domain.com traffic to http://domain.com?
<if header="host" match="www.yoursite.com" />
<redirect url="^(.+)$" to="http://yoursite.com$1" />
</if>
Thanks, dana, but here's what I ended up adding to my web.config file...
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect to WWW" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www.mysite.com$" />
</conditions>
<action type="Redirect" url="http://mysite.com/{R:0}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
精彩评论