Moving a single Drupal instalation into a multisite environment.

If you'd like to move a single installation of Drupal into a multisite environment, use these steps, and replace example.com for your websites name. In this example, Drupal is installed in /var/www/drupal/ .

1. Change the webserver configuration.

This one is obvious, the website was first pointing to an individual installation of Drupal, it needs to be directed to the multi-site installation of Drupal.

2. Copy templates, settings.php and files into the multisite environment.

mkdir -p /var/www/drupal/sites/example.com/
cd /var/www/example.com
cp -Rip html/sites/all/themes html/sites/default/settings.php html/sites/default/files/ /var/www/drupal/sites/example.com/

3. Update the MySQL database with the new paths.

If you have used files (including images) on your website, the path needs to be updated. Earlier files were located on "sites/default/files/", but this will become "sites/example.com/files"

mysql -u root -pPaSsWoRd
USE examplecom;
UPDATE files SET filepath=REPLACE (filepath, 'default', 'example.com');
UPDATE files SET filepath=REPLACE ('filepath', 'images', 'sites/example.com/images') WHERE filepath REGEXP '^images.*';
QUIT;

4. Change the location of the icons for the selected theme.

Go to Administer - Site building - Themes - Your Theme "configure" and change the path to reflect the right one. Mostly this means changing the word "files/" to "sites/example.com/files/".

5. Restart the web server and clean up the old environment.

For Apache, that would be:

apachectl configtest
apachectl restart

Check the website, everything should work, maybe you have to reselect your template to make it look better. If all works well, remove the old code.

rm -R /var/www/example.com

Comments

This is such an important

This is such an important information that I need to learn now. - Mark Zokle

Hi, thank you for the very

Hi, thank you for the very useful tutorial.

I'm a multisite newbie and need a clarification though:

when creating a new site in a multisite environment (say example.com), I create the following directories structure:

sites/example.com
sites/example.com/settings.php
sites/example.com/themes
sites/example.com/modules
sites/example.com/files
sites/example.com/tmp

I understand this part of your tutorial:
cp -Rip html/sites/all/themes html/sites/default/settings.php html/sites/default/files/ /var/www/drupal/sites/example.com/

and I assume I can add html/sites/default/themes/ to handle themes dir.

what about tmp dir?
is there any action needed to preserve the original environment?

thank you very much in advance
Simone (Italy)

The location of tmp depends

The location of tmp depends on your settings. I share a single tmp directory over multiple sites. Otherwise, just create a "tmp" or "temp" directory and refer to it in the file-system settings for your Drupal multisite.

you are the best! thanks a

you are the best! thanks a lot ;)

who put these guys to power in netherlands? they should reconsider...

About Consultancy Articles Contact




References Red Hat Certified Architect By Robert de Bock Robert de Bock
Curriculum Vitae By Fred Clausen +31 6 14 39 58 72
By Nelson Manning [email protected]