使用Intelligencia.UrlRewriter将www子域重定向到根域

问题描述:

如何在我的ASP.NET web.config文件中配置Intelligencia.UrlRewriter以将所有http://www.domain.com流量重定向到http://domain.com使用Intelligencia.UrlRewriter将www子域重定向到根域

感谢,德纳,但这里是我最终加入到我的web.config文件...

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

<if header="host" match="www.yoursite.com" /> 
    <redirect url="^(.+)$" to="http://yoursite.com$1" /> 
</if>