Joe Bianco
Dec 21, 2009
  9514
(3 votes)

Setting Up Multiple Sites in EPiServer CMS 5 Enterprise

Multiple sites can be managed from the Structure pane in Edit Mode with EPiServer CMS 5 Enterprise.  This enables Editors to conveniently manage multiple sites from one interface and share content, Page Types, Page Templates, and other settings between them. 

To add additional sites to the Structure pane, a home page needs to be created in Edit Mode for each additional site as a sibling of the home page of the first site.  In addition, site elements need to be created and configured for each additional site in web.config. 

Note that the multiple site configuration requires an EPiServer CMS 5 Enterprise license.  When multiple sites are configured, the content for all of the sites is stored in a single database.

Example - Setting Up Multiple Sites in EPiServer CMS

The following example describes how to set up multiple sites in EPiServer CMS 5 R2 SP2.  This example uses the EPiServer Public Templates and IIS 7 so steps may vary slightly depending on your environment.

 

1. Using the EPiServer Deployment Center, create the first site and database.  You will need an Enterprise license file for this site.  The Deployment Center will create the necessary site element for the first site in web.config. image
2. In IIS Manger, edit the site binding for the first site and add a Host name (e.g. – www.multisitedemo1.com).

Note: If you plan to open up the template project for this site with Visual Studio, you will need to update the IISUrl element in the .csproj file to match the host name entered above.  For example, <IISUrl>http://www.multisitedemo1.com</IISUrl>
image
3. In IIS Manager, create the second site,  point the Physical path to the same directory as the first site, and specify a Host name

Note: If you are using IIS 6 or IIS 7 in Classic Pipeline Mode, you will need to configure a wildcard mapping.  Integrated Pipeline Mode is the default for IIS 7, so you will probably not need to do this.  If you do, see the “Configuring EPiServer CMS 5 R2 SP1 Enterprise” article for instructions.
image
4. If you do not have DNS entries set up for your sites, create host entries for the site in the hosts file on the machine from where you will be browsing to the sites (C:\Windows\System32\drivers\etc\hosts). image
5. In Admin Mode, make the [Public] Start page Page Type “Available in Edit Mode” so that you can create a new home page based on this Page Type.  image
6. In Edit Mode, create the home page for the second site, using the [Public] Start page Page Template, as a child page of the Root folder. Take note of the Page ID. image
7. In web.config…

  • Create a new site element for the second site by copying and pasting the site element of the first site.
  • Set the siteId and description attributes on the site elements for both sites.  The siteId must be unique.
  • Set the pageStartId attribute of the siteSettings element for the second site to the Page ID of the home page that you created above.
  • Set the siteUrl attributes of the siteSettings elements for both sites.  The siteUrl must be the fully qualified domain name including protocol (see screen shot).
  • Add a siteHosts element to both site elements containing add elements for each host name that will be used to reference each site.  Note that one of the siteHosts elements must contain exactly one add element with a wildcard “*” host name to handle requests that do not map to any of the other host names.  Each host name must be unique within the scope of the sites element.
image

 

Additional Considerations

To ensure that each site maintains a unique and consistent look and feel, a unique Page Type can be created for each site’s home page enabling Administrators to restrict which Page Types and Page Templates can be used within each site.  This also simplifies the “Create New Page” page by only displaying the available Page Types to Editors when creating new pages.

Troubleshooting

If you run into an issue where the children of secondary site will disappear in the Structure pane when selecting primary site or vice versa, this is probably because the uiUrl attribute of the siteSettings element in web.config was modified and is not root relative.  If you need to modify the uiUrl attribute, make sure it is a root relative path.  For example, uiUrl="~/cms/".

Dec 21, 2009

Comments

Sep 21, 2010 10:33 AM

Hi,

I get this error when I try to call the second site, after the first has initialized:

Application is initialized with settings for siteId="x", but current request maps to siteId="y"
/ Lars

Sep 21, 2010 10:33 AM

Lars, I just had the same error. I am however using CMS 6. The instructions are slightly different so take a look here as well if your using 6:

http://world.episerver.com/Documentation/Items/Tech-Notes/EPiServer-CMS-6/EPiServer-CMS-60/Enterprise---Configuration/

In the end my problem was in episerverframework.config in the automaticSiteMapping where the siteId was duplicated as "DemoCMS6" for both settings and I needed to change the bottom one to my 2nd siteId:






Good luck!

Patrik Widman
Patrik Widman Sep 21, 2010 10:33 AM

I have the exact same problem as you Lars. Did you find any solution?

Sep 21, 2010 10:33 AM

Hi,

Also having the same problem as you Lars. Did you (or Patrik) find a solution to this?

Lars Jensen
Lars Jensen Sep 22, 2010 09:45 AM

Hi,

Yes, I found a solution. The wildcard should be at the last site, not the first, as in the above sample. So the line "" should be in "MultiSiteDemo2" - and it works!

Please login to comment.
Latest blogs
Introducing Optimizely Graph Source .NET SDK

Overview Of Optimizely Graph Optimizely Graph is a cutting-edge, headless content management solution designed to integrate seamlessly with any...

Jake Minard | Oct 10, 2024

Content Search with Optimizely Graph

Optimizely Graph lets you fetch content and sync data from other Optimizely products. For content search, this lets you create custom search tools...

Dileep D | Oct 9, 2024 | Syndicated blog

Omnichannel Analytics Simplified – Optimizely Acquires Netspring

Recently, the news broke that Optimizely acquired Netspring, a warehouse-native analytics platform. I’ll admit, I hadn’t heard of Netspring before,...

Alex Harris - Perficient | Oct 9, 2024 | Syndicated blog

Problem with language file localization after upgrading to Optimizely CMS 12

Avoid common problems with xml file localization when upgrading from Optimizely CMS 11 to CMS 12.

Tomas Hensrud Gulla | Oct 9, 2024 | Syndicated blog