during a recent job at the university i was in charge of setting up a lot of drupal sites and had to maintain them. most of them where drupal 6.x setups while at some point drupal 7 got released and i started creating new sites with drupal 7. at some point i noticed that i was managing more than 10 drupal installations on different web servers and i decided to start merging them into one drupal 7 multisite and i came across various problems.
the main problem is there is no updated drupal 7 multisite documentation and the documentation is missing the most important changes in drupal 7.x.
 drupal 6.x - define directories
the official documentation still tells you to name the subfolders correctly according to the used domain. like:
domain: 'example.com' -> directory: 'example.com' domain: 'sub.example.com' -> directory: 'sub.example.com' domain: 'example.com:1337' -> directory: '1337.example.com' domain: 'example.com/stuff' -> directory: 'example.com.stuff'
this is still valid and working pretty well. simply create for example the directory '/sites/example.com.stuff' including a default.settings.php and point your browser to the domain 'example.com/stuff' and just follow the instructions.
but if you have to change domains or subdomains or if you feel like changing the name of any sites-directory you would have to create symlinks which is pretty annoying if you only work on some vm webhosts without shell access. go for drupal 7.x and read on.
 drupal 7.x - use sites.php
Drupal searches for an appropriate configuration directory based on the website's hostname and pathname. A detailed description of the rules for discovering the configuration directory can be found in the comment documentation in 'sites/default/default.settings.php'. This file allows you to define a set of aliases that map hostnames and pathnames to configuration directories. These aliases are loaded prior to scanning for directories, and they are exempt from the normal discovery rules. The aliases are defined in an associative array named $sites, which should look similar to the following: $sites = array( 'devexample.com' => 'example.com', 'localhost.example' => 'example.com', ); The above array will cause Drupal to look for a directory named "example.com" in the sites directory whenever a request comes from "example.com", "devexample.com", or "localhost/example". That is useful on development servers, where the domain name may not be the same as the domain of the live server. Since Drupal stores file paths into the database (files, system table, etc.) this will ensure the paths are correct while accessed on development servers. To use this file, copy and rename it such that its path plus filename is 'sites/sites.php'. If you don't need to use multi-site directory aliasing, then you can safely ignore this file, and Drupal will ignore it too. Multi-site directory aliasing: Edit the lines below to define directory aliases. Remove the leading hash signs to enable. $sites['example.com'] = 'default'; $sites['sub.example.com'] = 'subdomain'; $sites['example.com:1337'] = 'leetsite'; $sites['example.com/stuff'] = 'stuffinside';
this simply lets you create clean directory names and as soon as you have to change the domain pointing at a certain subdirectory, you can easily modify the sites.php entry and the 'redirect' is valid instantly.
- ↑ run multiple sites from the same code base ( outdated!)
- ↑ quick install with ftp (drupal general documentation)
- ↑ change url of a multi-site ( outdated!)
- comment by Carnix: simple way explained how to set up d7 multisite in two steps.
- drupal 7 multisite improvement: multi-site directory aliasing: drupal coder explaining the new improvements.