Mugshot

Hey I'm Lee. My blog was put up to house useful nuggets I could refer back to, document my learning curves on new technologies and house tutorials I write for Umbraco and other .NET stuff.

All thoughts and comments on here are my own, and in no way reflect my employer - I also take no responsibility for spelling, grammar or terminology, so read at your own risk!

Blogs I Read

Sites I Like

301 Redirect Multiple Domains In Umbraco

I thought I had already posted this up, but seems I'm going mental and hadn't..

If you have a client site in which the client insists on having tons of domains pointing at it, and you don't have access to ISAPI rewrite to handle your redirects - you can actually 301 redirect using the Umbraco UrlRewriting.config.

Just set these up for each domain you need, the attribute values are pretty self explanatory.  Obviously the virtualUrl being the the domain you want to redirect FROM and the destinationUrl being the domain to redirect TO.

<add name="RedirectLeeDomain" redirectMode="Permanent" redirect="Domain" ignoreCase="true"
rewriteUrlParameter="IncludeQueryStringForRewrite" virtualUrl="http://www.leedomain.co.uk/(.*)" destinationUrl="http://www.n3o.co.uk/$1" />

You can use a similar rule to redirect non-www traffic to the www (or vice versa), e.g:

<add name="RedirectNonWww" redirectMode="Permanent" redirect="Domain" ignoreCase="true"
rewriteUrlParameter="IncludeQueryStringForRewrite" virtualUrl="http://n3o.co.uk/(.*)" destinationUrl="http://www.n3o.co.uk/$1" />

Simple as that… I wish I could take credit for this, but I actually found it out from Tim so tip of the hat to him Smile

Back to top