Information for:

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.

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 Acquia Cloud Site Factory.

To create a Drupal multisite, complete the following steps:

3. 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, and the aliases in the array $sites will override the default directory rules. See default.settings.php for more information about configuring this file. 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 emea.example.com and the website directory [docroot]/sites/europe, add the following line: $sites['emea.example.com'] = 'europe';


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

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

8. In the Acquia Cloud 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.

9. 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.

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

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 Acquia Cloud 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.
sites/*/settings*.php


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.

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

If you run a Drupal multisite on Acquia Cloud, 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 will 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, example.com) and you would like to create another website in a subdirectory of the same domain (for example, example.com/subsite), the multisite configuration process is somewhat different.

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

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/example.com.subsite.
4. On the Databases page, click PHP for the Acquia Cloud require statement for the new database. On your server, copy the default settings.php file from the /sites/default directory and add the Acquia Cloud require statement.
5. You may need to 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

After the changes propagate to the servers, you can access your website at example.com/subsite. If you must import a database, do that as well, or visit example.com/subsite/install.php to install a new Drupal website. You can also share database tables across a Drupal multisite.