How to documentation for creating Drupal 7 multisite configuration

johnathankent's picture

Let's create a wiki or documentation for "How to documentation for creating Drupal 7 multisite configuration".

I can help test and write the documentation. I may need some help setting mine up, too. So this would be beneficial for everyone.


Bright Web Design's picture

I am also really looking forward to multisite installation.
I think this is a must have documentation, because they changed a lot of things and the way the multisite works in Drupal7.
It really confuses, especially with the new example.sites.php

Can someone please give at least an explanation about the multisite configuration with multilanguage in Drupal7.

Very Interested and Trying to Figure it Out

weekbeforenext's picture

I can't seem to find any Drupal 7 specific direction for getting multisite up and running. I'm trying different methods of installing Drupal 7 on my local MAMP machine to see what works. Looking to get things going soon. More direction would be very helpful.

The first rule: Read the

Mile23's picture

The first rule: Read the code. :-) example.sites.php and default.settings.php tell you a lot, if you just read them.

The coolest addition in D7 is sites.php, which lets you set domain aliases, so that if you come from localhost (under MAMP, for instance), the connection can still be mapped to sites/ while you're developing and staging it. You can read it in the API documentation, which is taken directly out of the source file:

The other cool thing is that D7 can let you mix and match databases and prefix much more flexibly than D6. This gets explained in default.settings.php. You can have master and slave DBs, and give different databases different names within Drupal. This is explained here:

An article on some of this:

My multisite docs as posted...

ratioswitch's picture

I've posted a lot of my research on my host's wiki related to setting up Drupal multisites on typical Shared & Reseller hosting accounts (LAMP stacks): (FYI: this page does in fact, link back to g.D.o/multisites).

I've also posted a step-by-step install on A2's Get Satisfaction site:

I would greatly appreciate any feedback (good or bad) so that I can correct them. I would have no problem moving some of that content to a D.o or an g.D.o/multisites page since this might help consolidate some of this documentation.

I'm now trying to get D7's sites.php to handle my multisite-ing needs but need to read more about both on *D.o. and within both the sites.php and settings.php core files.

Has a wiki page for Multisite documentation been created yet?



It's actually easier to

Mile23's picture

It's actually easier to create a wiki page than it is to ask if someone else has created a wiki page. :-)

In fact: Wiki Page: Multisites Using Drupal 7. Edit away.

Local multisite installation's picture


The page assumes one has a DNS. I don't. Moreover, it's not much detailled. After much struggle, I eventually succeeded in installing a second site, but I'm not sure I didn't do mistakes and I think I probably did useless things.

I installed Drupal 7 on Ubuntu 10.10., /var/www/drupal-7.0/ . It worked. The non-Drupal site I have in /var/www/site/ also worked.

Then I copied /var/www/drupal-7.0/sites/default/ to /var/www/drupal-7.0/sites/ ,
gave read and write permissions to everybody for that directory (and I should have given them to its files/ subdirectory too),
copied /var/www/drupal-7.0/sites/ to /var/www/drupal-7.0/sites/ ,
modified it like this:

$databases = array (
  'default' =>
  array (
    'default' =>
    array (
      'database' => 'example',
      'username' => 'drupal_user',
      'password' => 'my_password.',
      'host' => 'localhost',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',

I copied /var/www/drupal-7.0/sites/example.sites.php to /var/www/drupal-7.0/sites/sites.php ,
modified its last line like this:
$sites['example'] = '';

created an empty database schema called "example" with MySqlAdministrator,
gave to user drupal_user@localhost the same password as above and the SELECT, INSERT, DELETE, CREATE, DROP, INDEX, ALTER, CREATE_TMP_TABLE and LOCK_TABLES privileges to this new schema.

Ubuntu's /etc/apache2/apache2.conf contains the lines

Include ports.conf
Include conf.d/
Include sites-enabled/

ports.confs says "NameVirtualHost *:80".

I created a file called /etc/apache2/sites-enabled/drupal-7.0 saying:

<VirtualHost *:80>
   DocumentRoot /var/www/drupal-7.0
   ServerName drupal-7.0

<VirtualHost *:80>
   DocumentRoot /var/www/drupal-7.0
   ServerName example

a file called /etc/apache2/conf.d/drupal-7.0.conf saying

Alias drupal-7.0
Alias example

<Directory /var/www/drupal-7.0>
    Options +FollowSymLinks
    AllowOverride All
  order allow,deny
   allow from all

in the file /etc/hosts , I added "example " to this line of aliases: example localhost.localdomain   localhost

relaunched Apache,
and went with my browser on the page http://example/install.php . It now works.

I realise that naming my folder "drupal-7.0" was a bad idea because browsers consider "drupal-7" as a subdomain of the top level domain "0" they go in internet to look for. Therefore http://drupal-7.0 doesn't work, I get my default website at the address http://localhost/drupal-7.0 .

Would anyone be so kind to check and clean this procedure?

What about a problem determination guide?

herb_miller's picture

It's all well and good documenting the steps to create a perfect installation but it doesn't help someone who has tried to follow the steps and has then come across a problem that's not explained.

In my case I get error 310 ERR_TOO_MANY_REDIRECTS whenever I attempt to navigate to one of my additional sites. See

If anyone has experience of fixing this issue please can you document the solution.

Note: My installation was performed using a one-click install of Drupal 7 using Softaculous. I couldn't find example.sites.php in the installed files. I have a niggling feeling that something has gone awry in the setup. I will check with my hosting supplier and also try to perform a manual installation.

herb_miller's picture

When I realised what the problem was the phrase "oh my giddy aunt" (or something similar but unpublishable) came to mind.
In order to track down the problem I manually installed Drupal 7 and then performed the same steps to set up a multi-site solution.
It worked perfectly. No need for symlinks.

I then took a complete backup of the working and non-working implementations and compared the file systems file by file.
The problem was blindingly obvious. In the non-working version ( with the error 310 - infinite redirect) there was no install.php file.

So step one of the problem determination guide for installation obviously starts at checking if install.php is present.

I now have two Drupal 7 multi-site installations. 2 domains on each. Hurrah!

WIBNI Drupal multi-site install did the check itself?

Annotation to /etc/apache2/sites-enabled

stfwi's picture

Thanks for this quick installation guide, it was very helpful for me.

One little annotation according to the apache2 handling of sites: The config for every site is normally specified in the files
"/etc/apache2/sites-available". Then you use the commands "a2ensite" and "a2dissite" to include/not include these config files. The commands simply add/remove symbolic links to the config files in the sites-available directory. After using a2ensite/a2dissite, the command "service apache2 reload" can be used to refresh the configuration without restarting the apache service. { The system I refer this to: Apache/2.2.17 (Ubuntu) }.

I think the solution in the installation guide above will not cause any trouble though - however, if people use a2dissite it could happen that the config file is accidentally deleted or an error could occur.

This apache2 handling also means that the aliases and virtual host configuration can be split into two config files, which can be individually enabled/disabled.

Hope it helps, cheers.

Multisite documentation

hvasconcelos's picture

Here's a simple and quick guide to setting up a Drupal Multisite. Hope it helps someone!