Site and Language Roots

An instance of N2CMS can actually host multiple websites, and multiple languages of multiple websites. When you first set up n2cms, the installer creates a root node under which all your sites are contained. The root node by default has the following children: 

  • start page or language intersection which represents the root of a particular website  (you can have more than one of these if you are hosting more than one website)
  • Trash bin which holds deleted content items from all sites in the N2 instance
  • An Upload folder which holds uploaded assets, such as images and available file downloads, which are accessible to all websites 

You should have one language intersection under your root node which represents a particular site, and then a start page for each language of that website. For example, your structure could look as follows:

  • Root node
    • (LanguageIntersection) my_website
      • (StartPage) en-us

      • (StartPage) es-es
      • (StartPage) ...
    • (LanguageIntersection) my_other_website
      • (StartPage) en-us

      • (StartPage) es-es
      • (StartPage) ...
    • (Trash)
    • (Upload)

Your content pages for each site/language combination go under the respective StartPage. 

Differentiating Multiple Websites (Virtual Sites in a single N2 installation)

There is currently no way to specify multiple hostnames for a differentiating site. A code contribution to fix this would be welcomed!

Hostname (DNS)

 You can assign a hostname to a language intersection (or a start page located directly under the Root node) by using the Site configuration menu. Depending on which template pack you are using, you can also configure custom HTTP 404 and 500 error pages by pointing to a node in your content tree. These custom 404/500 pages can even use parts like any other content page! 

Fill in the Site host name (DNS) field with the domain you want to map. If you leave this field blank (this is the default), then all domains will map to that site. 

Template/Theme

You can also customize the template or theme that this virtual site inherits by customizing the Site Theme option. The changes are applied immediately when you Save

Example Screenshot

n2_host.config file

The n2_host.config file maps hosts to root and start pages. URLs are generated relative to the StartPage specified in the startPageID attribute. 

<?xml version="1.0" encoding="UTF-8"?>
<!-- This is stored in a separate file so that the installation wizard can write to this file without write access to web.config -->
<host rootID="1" startPageID="4" multipleSites="true">
  <web extension="" />
  <vpp>
    <zips>
      <add name="n2.management" observedPath="~/N2/" filePath="~/N2/N2.zip"/>
    </zips>
  </vpp>
</host>

You should check that the rootID and startPageID node point to the correct root and start page node ID. You might need to look into the database to find the IDs of the start page and rootID. These values should be initially set up correctly by the N2CMS setup wizard. 

Additional Localization Option

Root
    StartPageEN (url : /)
        Page1EN
        Page2EN
        Page3EN
        StartPageFR (url : /fr) 
            Page1FR
            Page2FR
            Page3FR