Quick Tip: Assign multiple hostnames to the one production domain correctly

I've got multiple hostnames (domain URLs) for the same production site eg www.mywebsite.com and www.my-website.com, plus the .co.uk versions, how will that work with your domain license?

uSkinned Member

In this scenario you should assign your main production domain (mywebsite.com) to your domain license file.

Any live website should only be served via a single domain. Any other domains (e.g. my-website.com or mywebsite.co.uk) you own that are pointing to your website should redirect to a single domain. This is very important for SEO as each domain is seen as a unique site by google so the more domains you have pointing to a site without a redirect to a main domain will negatively affect your SEO.

There are many approaches to setting your domain up however the easiest is to add your redirect rules to the web.config file of your website. In the following example mywebsite.com is the main domain of your website.

<system.webServer>
<rewrite>
<rules>
<rule name="Redirect to WWW" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTP_HOST}" pattern="www.mywebsite.com" />
<add input="{HTTP_HOST}" pattern="www.my-website.com" />
<add input="{HTTP_HOST}" pattern="my-website.com" />
</conditions>
<action type="Redirect" url="http://mywebsite.com/{R:0}" />
</rule>
</rules>
</rewrite>
</system.webServer>

Using this approach your website will always be served via mywebsite.com no matter what domains are pointing to your website and your domain license will always work.

comments powered by Disqus

Get started today

Join thousands of agencies, freelancers, enterprises & start ups worldwide who use uSkinned Umbraco themes to deliver results for their business.