RikWare
...

Redirect domain names using UrlRewrite.NET

Tuesday, 30 October 2007 16:43 by admin

UrlRewriter.NET is a great tool for url rewriting in .NET. It can even be used to redirect domain names with.

e.g. RikPVR's main address is http://www.rikpvr.com/, but it can also be found at http://www.rikdvr.com/,http://rikdvr.com/ or http://rikpvr.com/ but ideally these should just redirect to the primary address. Using a host condition in UrlRewriter.NET makes this easy:


<if header="HOST" match="^((www.rikdvr.com)|(rikdvr.com)|(rikpvr.com))$">
<redirect name="RikDVR" url="^(.*)$" to="http://www.rikpvr.com$1" />
</if>
Categories:   General
Actions:   E-mail | del.icio.us | Permalink | Comments (3) | Comment RSSRSS comment feed

Comments

October 10. 2008 07:19

marco

Thanks for the tip. You saved me a lot of time.

marco

October 13. 2008 23:19

Abraham Luna

This code isn't working. I enter domain.com and get redirected to domain.com/www.desireddomain.com/Default.aspx

Abraham Luna

July 11. 2009 05:28

Scott Hugh Alexandar Petersen

Det er også fordi det skal gøres således Smile

<add name="DomainRedirect"
virtualUrl="^http://domain(.*)$"
destinationUrl="http://www.domain$1"
redirectMode="Permanent"
rewriteUrlParameter="ExcludeFromClientQueryString"
rewrite="Domain"
redirect="Domain"
ignoreCase="true"
/>
[/code]

Scott Hugh Alexandar Petersen

Add comment




biuquote
  • Comment
  • Preview
Loading