Cloud Platform

About Drupal multisite installations

Drupal can run multiple separate websites from a single codebase. In a Drupal multisite architecture, the individual websites share code (the Drupal core, modules, and themes), but each website has its own database so they do not share content, configuration, settings, or displayed themes.


By default, new sites in multisite or Site Factory applications got unique hash salt starting from July 9, 2020. Create a Support ticket to enable hash salt for the sites that were created before July 9, 2020.

A multisite configuration can help you with global website management tasks, such as website upgrades, since you must only upgrade one codebase. Running multiple websites from the same codebase can multiply problems, such as security issues, across all your websites. For a more robust solution, consider Site Factory.

To create a Drupal multisite:

  1. Sign in to the Cloud Platform user interface and select your application.

  2. Create an additional database for your new website.

  3. Create an additional domain for the new site. For more information, see Managing domains.

    Drupal uses the selection rules based on the multisite aliasing file sites/sites.php, which must be present to map multiple domains to specific directories. Drupal loads the optional settings in this file. The aliases in the array $sites overrides the default directory rules. For more information about configuring this file, see default.settings.php.

  4. Configure your aliases based on the sites/example.sites.php file.

  5. In your local code repository, go to your [docroot]/sites/ directory, and copy the /sites/example.sites.php file to sites.php in that directory.

  6. Edit sites.php to include an entry for each of your websites, mapping the website directory to the URL. For example, for a website with the URL and the website directory [docroot]/sites/europe, add the following line:

    $sites[''] = 'europe';

    For more information, see Using sites.php to specify an alternate settings.php file.

  7. Create a new folder in /sites/ by using the database name that you created earlier.

  8. Copy the /sites/default/default.settings.php file to your new website’s subdirectory, and rename it to settings.php.

  9. In the Cloud Platform user interface, go to the Databases page, and click PHP to display the include statement (also called the require statement) for your website.

    Copy the include statement to the clipboard.

  10. Edit the settings.php file in the new website’s subdirectory, and then paste your website’s include statement to the end of the file.

  11. Commit the changes to the new website’s settings.php file (and, if applicable, sites.php file) to Cloud Platform:

    In the following Git commit, the -a option commits all the changes you made to the workspace. To commit only a specific file or directory, replace -a with the name of the folder or directory.

    git commit -a -m "Added settings.php [and sites.php] for new website."

    The commit command in Git only commits your changes to your local clone of the repository. To push those changes up to your Cloud Platform website for deployment, use the git push command to push the changes to the appropriate branch. For example, when deploying from a branch named master, use the following command:

    git push origin master

    Some Drupal distributions may have a .gitignore file as in the following example:

    # Ignore configuration files that may contain sensitive information.

    Delete this line if it is present, because it prevents you from committing your website’s settings.php file. As an alternative, use the git add -f settings.php command to force the code commit.

  12. In your browser address bar, enter [site_URL]/install.php (where [site_URL] is the URL of the new website), and press Enter. Continue with the standard Drupal installation procedure.

If you run a Drupal multisite on Cloud Platform, you can add settings.php files to as many [docroot]/sites subdirectories as you need. Any domains for which you do not create a subdirectory fall back to the [docroot]/sites/default/settings.php file and load the default website.

Creating a multisite in a subdirectory of a domain

If you have a Drupal installation for a domain name (for example, and you would like to create another website in a subdirectory of the same domain (for example,, the multisite configuration process is somewhat different.

  1. Ensure you have defined on your Cloud Platform Domains page. You do not need to add domains with the subdirectory appended.

  2. Add a new database for your multisite, if you have not already done so. See Working with databases for more information.

  3. Add a multisite subdirectory to the /sites directory, as described in step 3 in the preceding procedure. In our example, you would name the multisite directory something like /sites/

  4. On the Databases page, click PHP for the Cloud Platform require statement for the new database. On your infrastructure, copy the default settings.php file from the /sites/default directory and add the Cloud Platform require statement.

  5. Create a symlink in your docroot, linking the subdirectory name up one level, to the docroot. For our example, create the symlink by executing the following from the command line while in the /docroot directory:

    ln -s ../docroot subsite
  6. Add and commit the symlink and your multisite directory to your code repository.

After the changes propagate to the infrastructure, you can access your website at If you must import a database, do that as well, or visit to install a new Drupal website.