Skip to main content

How to assign multiple hostnames or IP addresses

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 the main domain will negatively affect your SEO.

Step 1

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 main domain" 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>

 

Step 2

If your website is served via https, change the action type above to:

<action type="Redirect" url="https://mywebsite.com/{R:0}" />

And then add the following rule:

<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}/{R:1}" />
</rule>

 

Step 3

If your secure certificate has been assigned an IP address which can be directly used to access your website, you will also need to add the unique IP address assigned to your secure certificate to your conditions group.

<add input="{HTTP_HOST}" pattern="YOUR IP ADDRESS" />

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

Well done #h5yr!

uSkinned Site Builder

Get started — for FREE!

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