Multisite folder structure in Drupal

Last updated on
11 July 2022

Following is an example of the multisite structure with Drupal. For simplicity, other Drupal core folders and files are not listed.

Multisite structure:

-- core

-- modules
   -- contrib
   -- custom

-- themes
   -- contrib
   -- custom

-- sites
   -- site1
         -- modules
            -- custom
            -- contrib
         -- themes
            -- custom
            -- contrib
         -- files
   -- site2
         -- modules
            -- custom
            -- contrib
         -- themes
            -- custom
            -- contrib
        -- files
   -- site3
         -- modules
            -- custom
            -- contrib
         -- themes
            -- custom
            -- contrib
        -- files

Given a scenario where the entire multisite is maintained by a single person, only the files directories will normally exist in the directory structure below "sites". The modules and themes directories are only created in the webroot.

For more complex multisite environments, were multiple maintainers maintain their own site code, this may not apply. This complex scenario is expanded in the next section.

DevOps scenario:

In multisite environments, it is common that every site maintainer maintains their own site code. In complex environments, the front developers also want production deployments independent from regular Drupal deployments. Below is an example of how Drupal 8 and later multisite folders can be separated by multiple repositories. It is assumed that every site has its own database and code is shared as shown below.

.                    ----> Repository1 (common to all the developers)
-- core                                                           

-- modules
   -- contrib
   -- custom

-- themes
   -- contrib
   -- custom           ----> Repository2 (managed by front end developers)

-- sites
   -- site1            ----> Repository3 (managed by site1 developers)
         -- modules
            -- custom
            -- contrib
         -- themes
            -- custom
            -- contrib
         -- files
   -- site2            ----> Repository4 (managed by site2 developers)
         -- modules
            -- custom
            -- contrib
         -- themes
            -- custom
            -- contrib
        -- files
   -- site3            ----> Repository5 (managed by site3 developers)
         -- modules
            -- custom
            -- contrib
         -- themes
            -- custom
            -- contrib
        -- files

 This model has the following advantages:

1. Front-end developers can make independent deployments from regular Drupal deployments.

2. Every site maintainers can make independent deployments (for example every site maintainer can have their own release dates).

Help improve this page

Page status: No known problems

You can: