Last updated December 11, 2014. Created on April 25, 2008.
Edited by iantresman, brahmjeet789, Tommy Cox, joshk. Log in to edit this page.

If you are running more than one Drupal site, you can simplify management and upgrading of your sites by using the multi-site feature. Multi-site allows you to share a single Drupal installation (including core code, contributed modules, and themes) among several sites.

This is particularly useful for managing the code since each upgrade only needs to be done once. Each site will have its own database and its own configuration settings, so each site will have its own content, settings, enabled modules, and enabled theme. However, the sites are sharing a code base and web document root, so there may be security concerns with multiple administrators. (See section"Security Concerns" below for more information).



Overview of the Process

To create a new site using a shared Drupal code base you must complete the following steps:

  1. Create a new database for the site (if there is already an existing database you can also use this by defining a prefix in the installation procedure).
  2. Create a new subdirectory of the 'sites' directory with the name of your new site (see below for information on how to name the subdirectory).
  3. Copy the file sites/default/default.settings.php into the subdirectory you created in the previous step. Rename the new file to settings.php.
  4. Adjust the permissions of the new site directory, and grant write permissions on the configuration file (sites/default/default.settings.php).
  5. Make symbolic links if you are using a subdirectory such as and not a subdomain such as (see the subdirectory multi-site section below for details).
  6. In a Web browser, navigate to the URL of the new site and continue with the standard Drupal installation procedure (if you get an infinite redirection loop, check if the file install.php exists the document root).

It may also be necessary to modify your Web server's configuration file (often named httpd.conf for Apache) to allow Drupal to override Apache's settings. This is true for all installations of Drupal and is not specific to the multi-site install. Additional information is available in the Best Practices: Configuring Apache and PHP for Drupal in a Shared Environment section of the Install Guide.

           Back to Contents

Details of the Process

Domains, URLs, and sites subdirectory name

The new subdirectory of the sites directory has a name that is constructed from the site's URL. For example, the configuration for would be in sites/ You do not need to include 'www' as part of the directory name.

Drupal will use the same sites/ directory for any subdomain of, including www, unless there is an alternative, matching subdomain sites subdirectory. For instance, URL would be served from sites/, if it exists.

For a subdirectory URL, such as, name the sites subdirectory as follows: sites/ -- and read the section below on getting subdirectory multi-site working.

If you are installing on a non-standard port, the port number is treated as the first part of the subdomain. For example, could be loaded from sites/ If that directory doesn't exist, Drupal would then look for sites/, just like a real subdomain.

           Back to Contents

Site-specific modules and themes

Each site configuration can have its own site-specific modules and themes in addition to those installed in the standard 'modules' and 'themes' directories. To use site-specific modules or themes, simply create a 'modules' or 'themes' directory within the site configuration directory. For example, if has a custom theme and a custom module that should not be accessible to other sites, the setup would look like this:


           Back to Contents

Document root

One area of frequent confusion is that in a Drupal multisite installation the webserver document root is the same for all sites. For example with the following three sites:, and there will be a single Drupal directory and all sites will be calling the same index.php file.

Some webhosts automatically create a new directory (i.e. when creating a new domain or subdomain. In this case it is necessary to make it into a symbolic link to the main Drupal directory, or better yet when creating the domain or subdomain, set it to use the same document root as the site where you have Drupal installed.

           Back to Contents

Subdirectory multi-site

If you are attempting to get Drupal multi-site working using subdirectory URLs rather than subdomain or different domain URLs, you may encounter problems. You'll start out by making a directory such as sites/, and putting a settings.php file there. If this works for you, great! But it probably will not, until you make a symbolic link that tells your web server that the document root for is the same as the document root for To do this, go to the document root and type:

ln -s . subdir

(substituting the actual name of the subdirectory you want to make work).

If your codebase itself is in a subdirectory, then link your new site to the directory:

ln -s drupaldir subdir

For example, if your webroot is /var/www and you want and

1. Create Drupal install at /var/www/drupal/
2. Setup settings.php in /var/www/drupal/sites/ and /var/www/drupal/sites/
3. Create symbolic links in /var/www

ln -s /var/www/drupal /var/www/site1
ln -s /var/www/drupal /var/www/site2

This symbolic link is enough to resolve issues with subdirectory multi-site installations on at least some web hosts. If you still encounter problems with clean URLs and have access to edit the .htaccess file, try adding the following stanza immediately before the existing rewrite rule (for Drupal 7):

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteCond %{REQUEST_URI} ^/subdir
RewriteRule ^ subdir/index.php [L]

That block should go right after the RewriteBase / line, and before the other RewriteCond lines. What that does is catch incoming URLs that contain the subdir prefix and route them to the symlinked file so that they find the right database. Note that if you have multiple subdirectory-based multi-sites, each one will need its own block as above. It also may be necessary to use the absolute path to your subdirectory in line 4 above RewriteCond %{REQUEST_URI} ^/~user/path/to/symlink/subdir
(Based on this forum thread:

An unintended side effect of subdirectory multi-sites is infinite symlink recursion which search engine crawlers will follow, thus hurting SEO (see One can fix this using an n2 amount of .htaccess redirects based on the amount of sites you have like so:

RedirectMatch 301 /site1/site1/(.*) http://<your_site>.com/site1/$1
RedirectMatch 301 /site1/site2/(.*) http://<your_site>.com/site1/$1
RedirectMatch 301 /site1/site3/(.*) http://<your_site>.com/site1/$1
RedirectMatch 301 /site2/site1/(.*) http://<your_site>.com/site2/$1
RedirectMatch 301 /site2/site2/(.*) http://<your_site>.com/site2/$1
RedirectMatch 301 /site2/site3/(.*) http://<your_site>.com/site2/$1
RedirectMatch 301 /site3/site1/(.*) http://<your_site>.com/site3/$1
RedirectMatch 301 /site3/site2/(.*) http://<your_site>.com/site3/$1
RedirectMatch 301 /site3/site3/(.*) http://<your_site>.com/site3/$1

This covers any scenario of unwanted paths strung together and will redirect to the appropriate page i.e. will 301 redirect to, ensuring that only the latter gets indexed.

Note that these problems do not usually occur for multi-site installations using a subdomain, so you might want to try that if you cannot get subdirectory multi-site to work. (However, subdomains are not good for search engine rankings!)

           Back to Contents

Localhost alias for local workstation

On many systems it is possible to create entries in a "hosts" file to create aliases for the localhost name for a local workstation. By creating aliases for localhost it is possible to create names such as and, both for the local computer.

If on the other hand you use subdirectories in your local web root, create a symbolic link like this:

ln -s drupaldir subdir

and name your site folder localhost.subdir.

           Back to Contents

Domain name changes

Once a site is in production in a particular subdirectory under the sites directory, the subdirectory should not be renamed, even if the Web site URL changes. This is because several database tables (for example: system and files) include references to "sites/" Instead of renaming the sites directory, you can create a symlink to the new URL from the old one. Navigate to the sites directory and then use the following command:
$ ln -s /path/to/drupal/sites/

           Back to Contents

Security Concerns

You might want to reconsider using Drupal's multi-site configuration, in situations where the administrators for all of the sites being run from the same code base are not either the same person or a small group with a high level of mutual trust. The reason is that anyone with full administrative privileges on a Drupal site can execute arbitrary PHP code on that site through various means (even without FTP access to the site), and that arbitrary PHP code could be used from one site to affect another site, if the two sites are in the same HTTP document root and sharing the same Drupal code.

So, unless you completely trust all of the administrators of the sites you are considering running from the same Drupal code base to be knowledgeable, careful, and not malicious, you might want to consider installing their Drupal sites in completely separate areas of the web server that are not able to affect each other via PHP scripting.


Occasionally, Drupal is subject to security vulnerabilities, bugs which allow an unauthorised user access to Drupal core code. Once a hacker has access to your core code, they have access to all your multisites through one attack. Non-multisites require separate attacks, which may offer sufficient time for the vulnerability to be secured.

           Back to Contents

When to multisite

As a general rule on whether to use multisite installs or not you can say:

  • If the sites are similar in functionality (use same modules or use the same drupal distribution) do it.
  • If the functionality is different don't use multisite.

The Drupalcon Austin conversation/debate on multisite where the pros, cons, and some suggestions are discussed is available on youtube

This is because you want your sites to stay as up-to-date as possible regarding drupal module security updates and when you have different functionalities this is more difficult to do because it takes a little more time since you need to test each site independently. If you are doing multisite, then the update needs to be run at the same time for all the sites which is not always possible.

So sites with different functionality usually end up being upgraded at different times because each needs to be tested and backed up. Site updates and backups are also pretty easy to do and can be automated with drush, but drush has little support for multisite install.

           Back to Contents

Looking for support? Visit the forums, or join #drupal-support in IRC.


pfharris’s picture

Running multi site was easy to set up as described on Drupal 6.16, Fedora 12, Apache 2.x, PHP 5 on my Rackspace cloud. But after several few hours I gave up on getting clean URL's to work, and went back to several copies of the code, one for each site, as clean URL was important to me.

I'm sure it easy, I just can't figure it our alone. Sample files from a working multi-site with clean URL's would be nice please post if you have them.

wb54321’s picture

Even though I've done this successfully in the past, I drove myself a bit nuts this time around. I set up a multisite on a VPS and added two new domains, and was greeted with an error, then a "Drupal already installed" message. But I had forgotten to allow Noscript permissions for the new domains! I just used IE 8 and all went smoothly. Simple mistake, but wasted time figuring it out.

roshgorg’s picture

Will it be possible to create multiple sites by the registered users as in Wordpress...

Also,I would like to display certain modules to all the sub-sites registered under the main site. And, once a condition is satisfied, that particular module can be removed from that sub-site which satisfied the condition. Will it be possible.

Also, is it possible to select individual themes by users, and also, will it work with subdomains?

jackocnr’s picture

I've had a drupal multi-site setup working for a few months now, but have always wondered - should I have a directory in sites/ for each of my websites, or just the second one (I only have 2)? Lets say I had a site, for which I just used sites/default/ and sites/all/, then I added a 2nd site, for which I created sites/ Should I also have created sites/

I've read lots of conflicting information about this, but generally, multi-site how-tos don't tell you to create sites/ but maybe they assume you already have?


MadChris’s picture

Within the sites directory you will find at least two directories: "all" and "default".
The "all"-directory contains the shared files (modules and themes) while the default contains the site specific information (at least the settings.php and files directory, possibly also modules and themes).

In the Drupal Bootstrap (includes/ function conf_path()) Drupal looks for sites/SITE_URL/settings.php, but when this is not found, the fallback is to sites/default/settings.php.

So in short: you don't need a directory for your default website, only for the extra sites. :-)

kevin-bcr’s picture

Hi MadChris:

I found your comments helpful. One more clarification will help me. I'm confused about the SITE_URL in sites/SITE_URL/settings.php. I have an existing Drupal site that I've been setting up. I want to create another sub site for my daughter's business. She doesn't have a domain name yet. Let's say my site is called Would I just create a directory called sites/ Having done this, would her clients actually go to to see her site? Now, what if she doesn't like the address and wants here clients to go to Would this still work? Would I still begin with creating and then somehow redirecting people here from

Thank you!

MadChris’s picture

Hi Kevin,
You are on the right track, but you should distinguish server configuration from Drupal configuration.
If the other site doesn't have a domain name (eg., a subdomain is a good solution (eg.

First, you should setup your server configuration (DNS and virtual host) to make sure the new subdomain is routed to the same path on your server as the main domain (eg. /var/www/ . If you need more help on this topic, your hosting provider and google are your friends.

Without further Drupal configuration, both urls ( AND will serve the same site. But if you add the directory to your /sites directory and create a configuration file with a different database connection (or prefix), the domain will act as a separate Drupal installation.

Hope this cleared things up,