Last updated March 7, 2013. Created by karldied on January 8, 2006.
Edited by 2020media, jhr, peterx, LeeHunter. Log in to edit this page.

This branch needs a going over for deprecatable/archivable content. Feel free to update/deprecate as needed.

Instructions on multi-site configuration (also known as "multisite" and "single code base" installations) can be found within the installation instructions.

Here are some useful links:

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



1. Create dns entries for the sites ( or use hosts file for testing)
2. Create vhosts in Apache configuration file and restart Apache:

Listen 80
<VirtualHost *:80>
    DocumentRoot "C:/Program Files/xampp/htdocs"
    ServerName localhost:80
<VirtualHost www.site1.local:80>
    DocumentRoot "C:/Program Files/xampp/htdocs"
    ServerName www.site1.local:80
<VirtualHost www.site2.local:80>
    DocumentRoot "C:/Program Files/xampp/htdocs"
    ServerName www.site2.local:80

3. Create folder sites under drupal/sites


Note: Each site folder can have a file, tmp, modules and themes subfolders.

4. Copy settings.php from drupal/sites/default to each site folder.
5. Modify $db_url and $db_prefix in settings.php in each site folder.

For www.site1.local: Single database and db user.

$db_url = 'mysql://drupal:drupal@localhost/drupal';
$db_prefix = 'site1_';

For www.site2.local: Single database and single db user.

$db_url = 'mysql://drupal:drupal@localhost/drupal';
$db_prefix = 'site2_';

For www.site1.local: Multiple databases and single db user.

$db_url = 'mysql://drupal:drupal@localhost/site1';
$db_prefix = '';

For www.site2.local: Multiple databases and single db user.

$db_url = 'mysql://drupal:drupal@localhost/site2';
$db_prefix = '';

Note: Always use the same db user (the one that you used to install drupal for the first time) independently if you want to have a single or multiples db’s.

6. Open your web browser and point to the install.php file for each site


7. Your new sites are ready using a single code base, single db user and single or multiple db’s.


ant01's description is extremely helpful and cogent.

It appears that the instructions contemplate that each site has other content not controlled by Drupal. Thus, www.site2.local and www.site2.local/drupal would have different content. Perhaps the site owner has a static page for product information at the root URL, and the Drupal site is for employees, vendors, or customers.

However, for many of us, Drupal serves all content. If one wants the content for ALL traffic for www.site2.local to be served by Drupal, the following changes would be made:

Step 2: Add "/drupal" to the end of the DocumentRoot statement, so that it reads:

    DocumentRoot "C:/Program Files/xampp/htdocs/drupal"

Step 6: Remove "/drupal" from the path to install.php, so that it reads:

Step 7: Remove "/drupal/" from the URL:

Depending on your configuration, you may also need to change the RewriteBase from "/drupal" to "/". RewriteBase might be found in your Apache (or other httpd) configuration files or in htaccess, again depending on your configuration.

If you want to have non-Drupal content, but you want the Drupal content to be the default, use RedirectMatch:

     RedirectMatch ^/$ /drupal

The RedirectMatch alternative would still use "/drupal" in the URL of the Drupal site. The URL of www.site2.local would be redirected to www.site2.local/drupal. If the site had other content, such as www.site2.local/foo, content from "C:/Program Files/xampp/htdocs/foo" would be served.

Loye Young
Laredo, Texas

Loye Young
Isaac & Young Computer Company
Laredo, Texas

Some minor clarifications for us neophytes

if you get

Warning: Table 'drupalsite1dbnamehere.access' doesn't exist query: SELECT CASE WHEN status=1 THEN 0 ELSE 1 END FROM access WHERE type = 'host' AND LOWER('') LIKE LOWER(mask) ORDER BY status DESC LIMIT 0, 1 in C:\drupal\includes\ on line 172

you went to


instead of


Also, my hosts file got corrupted while messing with this, which may or may not be related to my mucking around with XAMPP and C:\WINDOWS\system32\drivers\etc\hosts, but if you can't seem to figure out why you can't go to http://www.site1.local/drupal, try recreating your C:\WINDOWS\system32\drivers\etc\hosts file. The entries should be localhost [should already be there] www.site1.local www.site2.local

Here's a variation of the httpd.conf file entries that works for me (note the / instead of the \ in the path name)

Listen 80
<VirtualHost *:80>
   DocumentRoot "C:/xampp/htdocs"
   ServerName localhost
   ServerAlias www.site1.local, www.site2.local, www.site3.local


here's how to do that with Direct Admin:

- create a subdomain in Direct Admin example:
- you have a subfolder in public_html, delete that folder with the contents
- chmod only the public_html folder to 777 to create the symlink
- create a symlink between public_html and the name of the sub = sub
upload ln.php to the public_html folder and go to
- make a new database in Direct Admin
- copy the /sites/default folder to /sites/
- edit settings.php and correct the database settings
- go to, you get errors with table not found, that's good!
- go to and run the install
- That's it!
- to delete a link upload unlink.php to public_html folder
- chmod only the public_html folder to 777
- run and that's it.

Here's the php code to create the symlink:

= '/home/username/domains/';
$link = '/home/username/domains/';
symlink($target, $link);

Here's the code to unlink the symlink:

//set the name of the link
$link = "dev";
//remove the symbolic link we created before

Let's say you want to use a single Drupal install to run your company's primary web site and your company's blog site (multisite), but you also have different themes and navigation hierarchies for the two sites. Sure, there are some Drupal modules that may provide most of this functionality. However, you can accomplish exactly the same thing with a plain vanilla Drupal install and the Pathauto module (a module that you should really be using anyways).

Check out the rest in my blog entry at: Drupal Multisite

If you're installing the second site in a sub-directoy, don't forget to change the RewriteBase in .htaccess. Here are the instructions that worked for me from

However, if your sites are in different subdirectories, RewriteBase will not work. You will need to create a special rule for each subdirectory. For example, your Drupal installation may serve the following sites:

In order to enable clean URLs for both sites, you will need to add

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/mysite/(.*)$
RewriteRule ^(.*)$ /mysite/index.php?q=$1 [L,QSA]

before the existing rewrite rules.

is it possible to run multisite on cherokee or any other light server? It's is relatively easy to run on a single drupal, but what about running on a multisite configuration?

Thanks in advance

Silicon Valley user group is organizing a Meet up on "Multisite IN Drupal" and the speakers include Karen Stevenson , Fred Davis and Jagdish Harsh.

RSVP here

for more details please contact me.

In an effort to host multiple sites using urls like I found I needed to have Alias's and rewrite rules for each sub-site in my vhost file:

Alias /drupal_1 /var/www
Alias /drupal_2 /var/www

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/drupal_1/(.*)$
RewriteRule ^(.*)$ /drupal_1/index.php?q=$1 [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/drupal_2/(.*)$
RewriteRule ^(.*)$ /drupal_2/index.php?q=$1 [L,QSA]

Here's a helpful page explaining Drupal multisite in subfolders.

In the same line of thought, if you use a subdomain for multisites, remember to 'hash' the following .htaccess option:
# RewriteBase /my_drupal_install_folder

Since my Drupal installation is in a subdirectory, I had activated this part in .htaccess :
RewriteBase /my_drupal_install_folder

My multisite subdomain has as root /my_drupal_install_folder, so it made no sense for the .htaccess to call for /my_drupal_install_folder

Once I added # before RewriteBase, all worked fine.

Nb - Tip : To create my multisite tables, I simply create a new database and use the phpMyAdmin option to copy all tables to another database. By doing this, you suddenly have an exact copy of your production site! But you'll need to flush all caches for your new multisite (ex.: to work.

Michael Lessard
webmaster of Quebec City 'democracy in action' Media (Drupal6)

I have a few Drupal sites installed...All of them used to have their own Drupal files.

Today, I decided to regroup two of them in only one Drupal installation (Each one keeps its own database)
The main site is and the one I wanted to use the same files is

I made all the necessary modifications (Create a subdirectory in sites/default, redirect the domain to the main Drupal installation folder, move the custom modules, themes and files folder, etc...) Things worked perfectly as long as I was using Firefox...Then, I tested on IE and Chrome....The home page shows TheBaySoccer on these 2 browsers. If I change the URL to, then I get the right page in any of the 3 browsers.

I think I am missing something. Maybe a reference to the old path in the database?

I contacted my host explaining the problem and asking them if there was a chance it had something to do with the server configuration...Their answer was not very satisfying:

"There are many reasons why a web page may not be visually consistent. If you added any CSS code, Iframes. nested tables, special fonts, widgets / gadgets, formatting characters and user text settings with different browser preferences, all of which can have different effects on different browsers. Sometimes, it gets so bad that the web designer will put a special logo stating that “this site is best viewed by using … browser”"

If anyone knows about this issue, please let me kmow...Thanks for your help!

Please see my post at for a D7 multisite install.

drupal 7 multi-site configuration is very simple, all you need is to read and understand the sites.php

a blackhole is where drupal divided by zero

How to install a install profile(Distribution) in multi site environment?
can i i uses same code base to different distributions?
if so how to do that?

There is an alternative Drupal-multisite setup done by Drupion: — Drupal-centric, Drupal-specific, Drupal-optimized hosting company.