开发者

Redirect www subdomain to root domain using Intelligencia.UrlRewriter

开发者 https://www.devze.com 2023-02-15 12:58 出处:网络
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.yours

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

精彩评论

暂无评论...
验证码 换一张
取 消