The 5.7 branch of Magnolia reached End-of-Life on December 31, 2023, as specified in our End-of-life policy. This means the 5.7 branch is no longer maintained or supported. Please upgrade to the latest Magnolia release. By upgrading, you will get the latest release of Magnolia featuring significant improvements to the author and developer experience. For a successful upgrade, please consult our Magnolia 6.2 documentation. If you need help, please contact info@magnolia-cms.com.

Multisite support is an Enterprise Edition Pro feature provided by the Multisite module. It allows you to manage multiple websites in a single Magnolia instance. Each site has its own site definition which can apply unique templates, themes, variations, domains and locales to the site. Besides making each site unique, the multisite feature lets you inherit features from another site.

You can use multisite support for microsites, campaigns, events and product launches. A microsite can inherit page templates from the parent site, yet have its own theme and domain. You save time and effort by not having to create new templates. Sites that are localized to the visitor's language or geographical area can inherit templates and themes from a parent site and add their own locales to support additional languages and country-specific domains.

Multisite requires an Enterprise Edition Pro license. You can create multiple site definitions also in EE Standard but you need an EE Pro license to unlock the multisite feature. With an EE Standard license, the system only takes the fallback site definition into account and will ignore additional site definitions.

If you do not need Multisite, it is best to remove the Multisite module jar from the bundle before you install Magnolia. Working with the Multisite module installed on EE Standard (running a single website) leads to WARN entries in your log files.

If you want to remove the Multisite module after installing:

  1. Move your site configuration to a new location - instructions for moving your site are included in the script.
  2. Execute one of the following groovy scripts depending on whether you use STK or not:


removeMultisiteSITE.groovy
import javax.jcr.Session;
import javax.jcr.Node;

//Before executing this script, update /modules/site/config/site and /server/i18n/content with your current /modules/multisite/config/sites/default configuration. The site should not be moved by script because you should manually check that: your roles are valid for the new site location; the site URI permissions do not reference just *, but /*; and if you use <site> patterns they are removed. 

//After execution, the webapp might be unresponsive. If so, shut it down, remove the multisite jar from your classpath (and any other modules that depend on it, such as marketing tags from the default modules we bundle) and restart it. Multisite should be removed at this point. 

def removeMultisite(shouldRemove) {

  println "Starting to remove multisite...";

  Session config = MgnlContext.getSystemContext().getJCRSession("config");
  Node root = config.getRootNode();

  if (root.hasNode("server/filters/multiSite")) {
    config.removeItem("/server/filters/multiSite");
  }

  if (root.hasNode("server/filters/crossSite")) {
    config.removeItem("/server/filters/crossSite");
  }

  config.getProperty("/server/filters/uriSecurity/class").setValue("info.magnolia.cms.security.URISecurityFilter");
    
  config.getProperty("/server/URI2RepositoryMapping/class").setValue("info.magnolia.cms.beans.config.URI2RepositoryManager");
    
  config.getProperty("/server/rendering/linkManagement/class").setValue("info.magnolia.link.LinkTransformerManager");
    
  config.getProperty("/server/i18n/authoring/class").setValue("info.magnolia.ui.framework.i18n.DefaultI18NAuthoringSupport");
    
  config.getProperty("/server/i18n/content/class").setValue("info.magnolia.cms.i18n.DefaultI18nContentSupport");

  config.getProperty("/modules/ui-admincentral/virtualURIMapping/default/class").setValue("info.magnolia.cms.beans.config.DefaultVirtualURIMapping");
  config.getProperty("/modules/ui-admincentral/virtualURIMapping/default/toURI").setValue("redirect:/.magnolia/admincentral");

  config.getProperty("/modules/site-app/apps/site/subApps/browser/contentConnector/rootPath").setValue("/modules/site/config/site");
    
  if (root.hasNode("modules/multisite")) {
    config.removeItem("/modules/multisite");
  }


  config.save();
  println "Multisite removed.";
}

//usage
removeMultisite(true);
removeMultisiteSTK.groovy
import javax.jcr.Session;
import javax.jcr.Node;

//Before executing this script, update /modules/standard-templating-kit/config/site and /server/i18n/content with your current /modules/multisite/config/sites/default configuration. The site should not be moved by script because you should manually check that: your roles are valid for the new site location; the site URI permissions do not reference just *, but /*; and if you use <site> patterns they are removed. 

//After execution, the webapp might be unresponsive. If so, shut it down, remove the multisite jar from your classpath (and any other modules that depend on it, such as marketing tags from the default modules we bundle) and restart it. Multisite should be removed at this point. 

def removeMultisite(shouldRemove) {

  println "Starting to remove multisite...";

  Session config = MgnlContext.getSystemContext().getJCRSession("config");
  Node root = config.getRootNode();

  if (root.hasNode("server/filters/multiSite")) {
    config.removeItem("/server/filters/multiSite");
  }

  if (root.hasNode("server/filters/crossSite")) {
    config.removeItem("/server/filters/crossSite");
  }

  config.getProperty("/server/filters/uriSecurity/class").setValue("info.magnolia.cms.security.URISecurityFilter");
    
  config.getProperty("/server/URI2RepositoryMapping/class").setValue("info.magnolia.cms.beans.config.URI2RepositoryManager");
    
  config.getProperty("/server/rendering/linkManagement/class").setValue("info.magnolia.link.LinkTransformerManager");
    
  config.getProperty("/server/i18n/authoring/class").setValue("info.magnolia.ui.framework.i18n.DefaultI18NAuthoringSupport");
    
  config.getProperty("/server/i18n/content/class").setValue("info.magnolia.cms.i18n.DefaultI18nContentSupport");

  config.getProperty("/modules/ui-admincentral/virtualURIMapping/default/class").setValue("info.magnolia.cms.beans.config.DefaultVirtualURIMapping");
  config.getProperty("/modules/ui-admincentral/virtualURIMapping/default/toURI").setValue("redirect:/.magnolia/admincentral");

  config.getProperty("/modules/ui-admincentral/apps/stkSiteApp/subApps/browser/contentConnector/rootPath").setValue("/modules/standard-templating-kit/config/site");
    
  if (root.hasNode("modules/multisite")) {
    config.removeItem("/modules/multisite");
  }


  config.save();
  println "Multisite removed.";
}

//usage
removeMultisite(true);

Installing

Maven is the easiest way to install the module. Add the following to your bundle. The parent POM of your webapp project should set the latest version of the module automatically. Should you need to use a specific module version, you can define it using the <version/> in the dependency.

<dependency>
  <groupId>info.magnolia.multisite</groupId>
  <artifactId>magnolia-module-multisite</artifactId>
</dependency>

Usage

See how to use Multisite.