You may have multiple domains pointing to your website but normally you want your website to use a single domain. You may also have staging and development environments set up and you don’t want domain rules interfering with these.

If you are using asp.net as the platform for your website there a a simple rule that you can add to your web.config file that will solve these two issues for you:

<rule name=”CanonicalHostNameRule1″>

      <match url=”(.*)”/>

      <conditions>

        <add input=”{HTTP_HOST}” pattern=”^website\.development$” negate=”true”/>

        <add input=”{HTTP_HOST}” pattern=”^website\.staging\.com$” negate=”true”/>

        <add input=”{HTTP_HOST}” pattern=”^www\.website\.com$” negate=”true”/>

      </conditions>

      <action type=”Redirect” url=”http://www.website.com/{R:1}”/>

</rule>

You may add it at the system.webServer > rewrite > rules.

The first three entries in the conditions section hold the domains of your several environments and the main domain of your website. All of these will be ignored by this rule when you access them.

In the action section place the main domain of your website. All other domains will redirect to this one. This includes non-www domains (e.g. website.com will redirect to www.website.com).

You can find documentation for this and all sorts of rules here.