Handling Multiple Hostnames in Sitecore using Wildcard

There will be scenarios where you need to target multiple hostnames to a single website. A typical scenario would be hostname with (www subdomain) and a non-www hostname.

For instance :

  1. example.com
  2. www.exmaple.com

Standard Site Definition Example with Single Hostname entry:

The best way to achieve this in Sitecore is through wildcards. Sitecore supports wildcard in the hostnames and with the help of wildcard multiple hostnames can be targeted in the single site definition node.

Handling Multiple Hostnames in Sitecore using Wildcard

First, let us take a look at the solution by adding the multiple domains into a single hostname field with the help of wildcard.

Site Definition Example with mutiple domains:

In the above example, we have added the 3 different domains with the help of wildcard and it will resolve the below domains without any issue.

  1. example.com
  2. www.example.com
  3. myanotherdomain.com

One thing to remember here is the domain names will be processed in order. Hence whatever matches the first will be processed even if the there is a second match which is more relevant than the first.


You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.