Magnolia 5.7 reached extended end of life on May 31, 2022. Support for this branch is limited, see End-of-life policy. Please note that to cover the extra maintenance effort, this EEoL period is a paid extension in the life of the branch. Customers who opt for the extended maintenance will need a new license key to run future versions of Magnolia 5.7. If you have any questions or to subscribe to the extended maintenance, please get in touch with your local contact at Magnolia.

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:

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

Pre-built JARs are also available for download. See Installing a module for help.

Usage

See how to use Multisite.