Configure multiple managed websites

Current version: 10.2

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

Embedded sites are not supported. For example, in this configuration:

  • Site 1 => rootItem="sitecore/content/site1" startItem="Home" ...

  • Site 2 => rootItem="sitecore/content/site1/home" startItem="Home" ...

Site 2 is embedded because it refers to content of Site 1. The following configuration is valid because the root paths refer to different root items:

  • Site 1 => rootItem="sitecore/content/site1" startItem="Home" ...

  • Site 2 => rootItem="sitecore/content/site2" startItem="Home" ...

Important

When you choose a name for the website, avoid using characters that are invalid for the website cookies. Therefore, do not use control characters, spaces (" "), semicolons, or commas in your website names.

The virtualFolder and physicalFolder properties

The virtualFolder and physicalFolder properties are part of the site configuration, as shown in the next section.

The physicalFolder property defines the physical location of files for the site, relative to the Sitecore root. Files stored in the physical folder take precedence over the Sitecore items.

The default value of physicalFolder is "/".

Note

The PhysicalFolder value directory must exist under the Sitecore root and contain all the necessary files in the proper structure.

The virtualFolder property defines a prefix that is added after the host name definition and is used to resolve sites according to URLs. Together with the hostName attribute, this defines a unique website. For example, the following configuration defines the URL http://mysite.com/virtual:

RequestResponse
<site 
        name="test"
        hostName="mysite.com"
        virtualFolder="/virtual"
...

The default value of virtualFolder is "/".

Configure the website

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 mysite:

    RequestResponse
    <?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>
    Important

    It's important to pay attention to the order in which sites appear in the <sites> list. For more information, read about how website context is determined.

  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 website that you add. Attributes can vary from version to version due to updates or new features in the product. Therefore, after any upgrade 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. In the hosts file of your computer or server, enter the host name of the website in the following format:

    RequestResponse
     102.54.94.97 rhino.acme.com # source server
Note

In the Sitecore.config file, the Preview.DefaultSite setting determines which website Sitecore displays if a user clicks Preview in the Sitecore Desktop menu. If a user doesn't have access to the default website, they get an error message.

Do you have some feedback for us?

If you have suggestions for improving this article,