Moving a single Drupal instalation into a multisite environment
11:56If 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 restartCheck 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