Platform Administration and Architecture

Determining website context

You configure additional managed websites for different purposes and different domains by adding them to the site definition node in the Sitecore.config file. For example, you can define a new site to be your published public-facing site or to be used by content editors to access the content management system.

Sitecore determines the website context based on the incoming URL and the following two attributes:

  • hostName – specifies the name of the website as it appears in the incoming URL. It can contain wildcards.

  • virtualFolder – the physical path to the website root folder.

When Sitecore receives an incoming URL, it first compares the URL to the hostName attribute of each site in the <sites> list in the config file.

If the hostName attribute matches the incoming URL or the hostName attribute is empty, Sitecore next compares the virtualFolder attribute.

Sitecore uses the first site definition in the <sites> list where the hostName and virtualFolder attributes match the incoming URL as the context site.

Note

Sitecore checks for sites in the same order that they occur in the list. Therefore, you must list sites starting with the most specific entry and ending with the most general entry. For example, if you have a website where hostName is mysite.com.au and another website where hostName is mysite.com, the entry for mysite.com.au must be first in the list. Otherwise, an incoming URL for mysite.com.au will match the entry for mysite.com first.