The dotCMS supports the addition multiple Sites that can all share the same templates, containers, files, and content as needed. You can create as many Sites as your server/network hardware specifications will allow. The Site addresses will, of course, need to be configured/maintained in the DNS records of your organization by a system administrator.
Sites are controlled by the “Sites” system Content Type. Users with administrative permissions can see a Change Site select box (see below), at the top right hand corner of the “Content” or “Site Browser” tabs.
From the select box, a backend user can switch between Site(s) that he/she is permissioned to view. Clicking on “Manage Sites” brings you to the global Sites page (see image below).
Clicking the “Add Site” button (see above), allows administrators to add a new website or “Site” to the system. This new website will have it's own folder directory tree and can be assigned specific user permissions and dotCMS objects that pertain specifically to that Site (templates, containers, etc,.). After clicking on “New Site” options are provided to “Copy an existing Site” or “Start with a blank Site”.
Copying a Site
Selecting the option to copy and existing Site and “Next” opens the “Select a Site to copy” window. From this window a Site can be selected from the select box provided and then check boxes at the bottom of the window allow for all or only selected dotCMS object types to copied into the new Site.
After choosing the Site to copy, clicking on “Next” opens the add new Site window.
Adding a New Site
Whether adding a blank Site or having already copied a pre-existing Site, the add new Site window options are the same. The new Site must have a Site name that should match it's primary domain or website address. Additionally, the Site can have alias domains that also map to the same dotCMS server (ip address). A thumbnail for the Site can also be selected to help differentiate the Site from other managed Sites (optional).
Clicking the “Save” button on the Site saves a draft copy of the Site that is not externally accessible to the public, REGARDLESS of the permissions set on the Site. Only by clicking on “Save/Activate” can a new, or copied Site, be made public- permissions permitting.
Additional Site Settings
After saving a new Site, users are brought to the “Manage Sites” portlet. From “Manage Sites,” right-clicking on a Site name exposes the following options:
- Edit - Edit the Site (name, *permissions, add alias, etc.)
- Edit Site Variables - Site variables can be used to add unique variable values that refer to Site specific attributes. See Adding a Site Variable documentation for more information.
- Stop Site - Makes Site inaccessible to the public (similar to an unpublish on content)
- Make Default - Makes the selected Site, the default site on the server. If the server does not match the Sitename or the Site alias for any Site on the instance in the URL, the user will automatically be re-directed to the default Site.
- Add To Bundle - Adds the Site to a bundle for push publishing to another dotCMS server
Custom Maintenance and Error pages for each Site
Custom error and maintenance pages can be set up for each Site by configuring a Vanity URL for each error page. For more information please see the Custom Error Pages documentation.
Permissions on Sites
Learn how to permission user roles on Sites in the Site Permissions documentation.
**Sites in dotCMS work very much like virtual Sites in apache, since you can have a single IP address but serve multiple websites, depending on which Sitename the client requests. During testing, you can use your host file (/etc/hosts on Unix like OS's, or C:\WINDOWS\system32\drivers\etc\hosts in Windows) to be able to access your virtual Sites. While you can have dotCMS listening on multiple IPs, there's no way to have a default Site for each IP. So you need to have either DNS records, or during development, set up your Hosts file on your local machine.