---
title: "About Drupal multisite installations"
date: "2024-02-14T06:18:38+00:00"
summary: "Learn how to set up and manage Drupal multisite installations. Share code across multiple websites while maintaining separate databases and configurations for efficient global site management."
image:
type: "page"
url: "/acquia-cloud-platform/about-drupal-multisite-installations"
id: "857720ca-6dbb-4623-9f4d-205c0bf5833c"
---

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.

Note

By default, new sites in multisite or Site Factory applications got unique hash salt starting from July 9, 2020. [Create a Support ticket](/service-offerings/support#contact-acquia-support) 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.

Common use cases for a Drupal multisite include:

*   Build a new site through a new installation process.
    
*   Copy a local site to Cloud Platform. In this case, Acquia recommends that you clear your Drupal cache if you have [imported a database](/acquia-cloud-platform/importing-your-database "https://docs.acquia.com/cloud-platform/create/import/manual/manual-db/").
    

To create a Drupal multisite:

1.  [Sign in to the Cloud Platform user interface](/node/55875) and select your application.
2.  [Create an additional database](/acquia-cloud-platform/manage-apps/database#cloud-add-new-db) for your new website.
3.  Create an additional domain for the new site. For more information, visit [Managing domains](/acquia-cloud-platform/manage-apps/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, visit [default.settings.php](http://cgit.drupalcode.org/drupal/tree/sites/default/default.settings.php#n15).
    
4.  Set the DNS for that domain with your authoritative DNS provider to point to the environment IP address with an A record. For more information, visit [Configuring DNS records for your application](/acquia-cloud-platform/configuring-dns-records-your-application "Configuring DNS records for your application").
    
5.  Configure your aliases based on the `sites/example.sites.php` file.
6.  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.
7.  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, visit [Using sites.php to specify an alternate settings.php file](/acquia-cloud-platform/help/93781-using-sitesphp-specify-alternate-settingsphp-file "Using sites.php to specify an alternate settings.php file").
    
8.  Create a new folder in `[docroot]``/sites/` with the database name that you created earlier.
9.  Copy the `/sites/default/default.settings.php` file to your new website’s subdirectory, and rename it to `settings.php`.
10.  In the Cloud Platform user interface, go to the **Databases** page, click **PHP** to display the include statement (also called the require statement) for your website, and copy that statement to the clipboard..
     
     ![cloud-platform_viewing-php-details.png](https://acquia.widen.net/content/6abe9a24-6322-4f55-8430-1a3a0a88c7f3/web/cloud-platform_viewing-php-details.png)
     
11.  Edit the `settings.php` file in the new website’s subdirectory, and paste your website’s include statement to the end of the file.
12.  If there are any unique modules or themes for the new site, create a `/docroot/sites/<new-site>/modules` or `/docroot/sites/<new-site>/themes` folder and add the code. Typically, you must put details about only custom modules that do not exist in any other site in these folders. Other modules or themes must be in:
     *   `/docroot/sites/all/modules` or `/sites/all/themes` folder for Drupal 7
     *   `/docroot/modules` or `/docroot/themes` for current Drupal version
13.  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.
         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.
     
14.  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.

Note

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, `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 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. For more information, visit [Working with databases](/acquia-cloud-platform/manage-apps/database).
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 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 `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.
    

### URL redirection

When you access your website after completing the preceding task, the following redirection sequences occur:

*   The URL is initially redirected from HTTPS to HTTP. For example:
    
        john.galvin@MacBookPro-SanjayMogra  ~  curl -sLI https://www.google.com/central-california 
        HTTP/2 301 
        server: nginx 
        date: Tue, 25 Nov 2025 10:06:26 GMT 
        content-type: text/html; charset=iso-8859-1 
        content-length: 249 
        location: http://www.google.com/central-california/ 
        x-content-type-options: nosniff 
        cache-control: max-age=1209600 
        expires: Mon, 08 Dec 2025 16:54:47 GMT 
        x-request-id: v-4906bbce-c956-11f0-8eb7-bfe482f7ba74 
        age: 61899 
        via: varnish 
        x-cache: HIT 
        x-cache-hits: 257
    
*   The URL is further redirected to HTTP but gets appended with a trailing backslash (`/`).
    
        HTTP/1.1 301 Moved Permanently 
        Server: nginx 
        Date: Mon, 24 Nov 2025 16:54:47 GMT 
        Content-Type: text/html; charset=iso-8859-1 
        Content-Length: 250 
        X-Content-Type-Options: nosniff 
        Location: https://www.google.com/central-california/ 
        Cache-Control: max-age=1209600 
        Expires: Mon, 08 Dec 2025 16:54:47 GMT 
        X-Request-ID: v-490f5388-c956-11f0-987c-abf025173595 
        Age: 61899 
        Via: varnish 
        X-Cache: HIT 
        X-Cache-Hits: 214 
        Connection: keep-alive
    

Related topics
--------------

*   [Multisite Drupal](https://www.drupal.org/docs/multisite-drupal)
*   [Using sites.php to specify an alternate settings.php file](/acquia-cloud-platform/help/93781-using-sitesphp-specify-alternate-settingsphp-file "Using sites.php to specify an alternate settings.php file")
*   [Multisite Drupal 7](https://www.drupal.org/docs/7/multisite)
*   [Multisite - Sharing the same code base](https://www.drupal.org/docs/7/multisite-drupal/multi-site-sharing-the-same-code-base)