Configure multiple managed websites

Last updated Wednesday, October 11, 2017 in Sitecore Experience Platform for Administrator

A single Sitecore instance uses multiple websites to manage content delivery, content management, and many other features. However, by default there is only one published website. This website corresponds to the <site name="website"…/> definition in the Sitecore.config file.

You can 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.

To configure an extra Sitecore website:

  1. Add a patch file containing the new site definition.

    Note

    You must not add the definition directly to the <sites> list in the Sitecore.config file because changes to the file can be lost during an upgrade process.

    The following example adds a website called admin:

    <?xml version="1.0"?>
    <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
        <sitecore>
            <sites>
              <site name="mysite" patch:after="site[@name='modules_website']"
                targetHostName="rhino.acme.com”
                enableTracking="true" virtualFolder="/" physicalFolder="/"
                rootPath="/sitecore/content/mysite" 
                startItem="/home" database="web" domain="extranet"
                allowDebug="true" cacheHtml="true" htmlCacheSize="50MB" registryCacheSize="0"
                viewStateCacheSize="0" xslCacheSize="25MB" filteredItemsCacheSize="10MB"
                enablePreview="true" enableWebEdit="true" enableDebugger="true"
                disableClientData="false" cacheRenderingParameters="true"
                renderingParametersCacheSize="10MB" />
            </sites>
        </sitecore>
    </configuration>
  2. For each added website, configure the website attributes depending on the purpose of the website. The attributes and their purpose are described in the comments before the <site> section in the Sitecore.config file.

    Note

    You must define all attributes for each added website. Attributes can vary from version to version due to updates or new features in the product. Therefore, after any upgrade you must check the attributes for the default site in the Sitecore.config file, because there can be changes that require you to update the attributes of any added websites.

  3. Enter the host name of the website in the hosts file of your computer or server, in the following format:
          102.54.94.97     rhino.acme.com          # source server

Website context

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 an incoming URL is received, Sitecore first compares it to the hostName attribute of each site in the <sites> list.

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

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 order in which they are included in the list. Therefore, sites must be ordered 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 one 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.

Send feedback about the documentation to docsite@sitecore.net.