Setup multisite


You need a TLD for Engine. All sites will be a subdomain of the main domain. Each subdomain matches a LocomotiveCMS site.

  • Main domain served by the engine:
  • Site A:
  • Site B:
  • ... and so on.

Of course, sites may also have their own TLDs, but the engine as a whole needs it’s own TLD.

In addition to the subdomain which represents the default entry point (ex:, a site can have other "domain" aliases. Actually, the LocomotiveCMS engine is able to retrieve the site based on the requested domain.

How to test it locally

1. TLDs

If you’re doing this in development, you can add the TLDs and subdomains into your host file.

Open your /etc/hosts file.

You will need your unix root password to execute the following shell command.
sudo vi /etc/hosts

Add the following lines if you want to follow the example above.

2. Engine

After setting up your LocomotiveCMS engine, crack open config/initializer/locomotive.rb. Uncomment the multisite setting:

config.multi_sites do |multi_sites|
  # each new website you add will have a default entry based on a subdomain
  # and the multi_site_domain value (ex:
  multi_sites.domain = ''
# config.multi_sites = false

Restart your LocomotiveCMS engine. Now, you will be able to create a new site with alpha or bravo as the subdomain.

How to set it up in production

You have to own a domain name and also have fully access to it in order to enable the multisite functionality.

Let's say you purchased the domain name.

1. Configure your DNS

Basically, you will have to add the following lines in your DNS zone.


2. Configure your engine

Open your config/initializer/locomotive.rb file.

config.multi_sites do |multi_sites|
  multi_sites.domain = ''
# config.multi_sites = false

Once it is done, deploy your code to the production server.

3. Create a new site

Use the LocomotiveCMS back-office to create a new site. Use any subdomain you want since the wildcard entry has been correctly added to the DNS.

4. Add a new domain name to your site

First, add the new domain name (ex: to the list of domains inside the LocomotiveCMS back-office of your site.

Then, the new domain name will have to point to You can do it by adding a new CNAME entry in the DNS settings of your site.

  www 10800 IN CNAME
You can't add a CNAME to a root domain name. A good solution is to make a web redirection from the root domain name to www.
You could also use a reverse proxy but we recommend the first solution.

Now, if you type in your browser, you will see the LocomotiveCMS site you coded.

© 2024 LocomotiveCMS Terms of use Privacy Policy
Back to top