Add/Copy Sites

Last Updated: Apr 29, 2024
documentation for the dotCMS Content Management System

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 need to be configured/maintained in the DNS records of your organization by a system administrator.

Sites are controlled by the Host system Content Type. Users with administrative permissions can see the Site Selector (see below), at the top right corner of the Content Search or Site Browser tabs.

Site selector.

From the select box, a back-end user can switch between site(s) that they are permissioned to view.

Site Manager

To manage sites, use the tool located under Settings -> Sites.

Sites tool within Settings tool group.

From here, you can left-click on any site to edit its properties, or right-click to take contextual actions.

The site-manager pane displays existing sites under two columns:

ColumnDescription
Site KeyDisplays the site name, which must be a single word, typiclly be in the style of a domain or subdomain.
AliasesDisplays additional domain names registered and configured to point at the dotCMS server; if properly configured, dotCMS will resolve requests to the correct site.

Clicking the Add Site button allows administrators to add a new website to the system. This new site will have its 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 New Site, you will be given a choice between “Copy an existing Site” or “Start with a blank Site.”

Dialog offers choice between copying a site or creating a blank site.

Copying a Site

Selecting the copy option and clicking Next opens the Select a Site to copy dialog. A site can be selected from the select box provided; checkboxes allow for all or only selected dotCMS object types to copied into the new site.

Dialog offering checkboxes to choose which objects to copy.

After choosing the site to copy, clicking on Next opens a prefilled contentlet of the Hosts system Content Type.

Host properties are adjusted in the content editor.

Adding a New Site

Whether adding a blank site or having already copied a pre-existing site, editing the contentlet presents the same set of fields; a site, like nearly everything in dotCMS, is a form of content.

Sites typically have a site name that matches its primary domain or website address. In consequence of this, a site name is limited to a single word, though hyphens and periods can be used throughout. Additionally, the site can have alias domains that also map to the same dotCMS server (or 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, where permissions allow.

Additional Site Settings

Context menu on right-clicking on a site.

After saving a new site, users are brought to the Sites tool. From here, right-clicking on a site name exposes the following options:

OptionDescription
EditEdit the site's contentlet, allowing adjustment of name, permissions, aliases, and so on.
Edit Site VariablesSite variables can be used to add unique variable values that refer to site-specific attributes. (See Adding a Site Variable for more information.)
Stop SiteMakes site inaccessible to the public (similar to unpublishing other content).
Make DefaultMakes the selected site the default site on the server. If the server does not match the site key or the site alias for any site on the instance in the URL, the user will automatically be redirected to the default site.
Add To BundleAdds 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.

Note on Host File

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 site name the client requests. During testing, you can use your host file (/etc/hosts on a Unix-like OS, 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 is 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.

On this page

×

We Dig Feedback

Selected excerpt:

×