PLEASE MODIFY THIS DOCUMENT with your tips and clues and links and hard-won wisdom.
What Is Multisites?
Multisites is a capability of Drupal to run many web sites out of one installation of Drupal.
That is, if you install Drupal somewhere, you can then place different file directories and settings files for a number of different web sites within the /sites folder.
Because of the way multisites works, you can have different domains and subdomains and paths mapped to different directories within /sites. So, for instance, while Drupal multisites can support two different websites like example.com and anotherexample.net, it can also support different settings and databases for example.com and foobar.example.com.
Drupal 7 adds a relatively easy ability to define multiple databases per site (in parallel, and also as master/slave setups), and also share databases between sites.
As a development convenience, Drupal 7 file allows you to set up domain aliases, as well. This lets you develop a web site locally, as localhost for instance, which will map to one of your multisite directories, such as example.com. This is done using the example.sites.php file. Details below.
One Install To Rule Them All
The philosophy of multisite: Do as little as possible, and let Drupal figure it out.
Do not mess with symbolic links or aliases. Do not add other modules until you're sure you need them. Just get your multisite setup working acceptably first by reading a lot, configuring a little, and assuming Drupal knows what its doing.
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/yourfancysitename.com while you're developing and staging it. You can read it in the API documentation, which is taken directly out of the source file: http://api.drupal.org/api/drupal/sites--example.sites.php/7
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: http://drupal.org/node/310071
An article on some of this: http://www.drupalcoder.com/story/544-drupal-7-multisite-improvement-mult...
The Skeleton of a Drupal 7 multisite guide can be as follows :
Install Drupal 7 the normal way on the first domain.
Make your DNS work for the second site's domain (2ndsite.com) to point to same IP.
Make your Web server work for the second site's domain to point to same directory. (for apache this can be adding the second domain as an alias in the current host or making a new virtual host that has the same document root)
Make a new directory with name equal to the second site's domain in under the sites directory (drupal7/sites/2ndsite.com)
5.a. chmod the second site's directory (drupal7/sites/2ndsite.com) to 777 (change permissions so that they can be modified by anyone)
5.b. Make a new directory called files (drupal7/sites/2ndsite.com/files) and chmod this new directory to 777.
Copy default.settings.php to the new site's directory as settings.php (drupal7/sites/2ndsite.com/settings.php) and then chmod it to 666
Navigate to the second domain (2ndsite.com) and install Drupal normally.
It can be easily noticed that steps from 5 to 7 are normally done when installing Drupal (like in first step).
For a multisite local installation of Drupal, see Local multi-site installation of Drupal 7 on Linux.
Alternatively steps 7 and further in my situation (@summit):
7. Copy example.sites.php to sites.php (keep it withing drupal7/sites) then chmod it to 666
8. Add the bottom op sites.php set up the mapping using the sites array:view source
$sites['secondsite.com'] = 'secondsite.com';
9. Then chmod sites.php it to 666
10.Navigate to the second domain (2ndsite.com) and you will see the first site.
11.Add domain access module and other domain modules: www.drupal.org/project/domain for best multisite handling.
12. All of the sites will want to use the .htaccess file in the main D7 directory. For this reason, the RewriteBase directives in this .htaccess must be commented out:
Otherwise clean urls will not work.
Working with Primary domains and Root subdirectories
If you want to store all Drupal files in a subdirectory on root (public_html) and then point the primary domain to that subdirectory, here's how I did it so that when I visited my site I wouldn't see the subdirectory be part of the URL, and most important, that it will still work with URL aliases and the Multisite structure, e.g.
http://example.com // good
- I added the following lines on the .htaccess of the root folder (Not the .htaccess of the Drupal directory).
RewriteRule ^(.*)$ http://<domain>/<subdirectory>/$1 [P]
- Added the $base_url in the "settings.php" file.
$base_url = 'http://<domain>'; // NO trailing slash!
Transform old separate sites into Multisite
• Blank page ›› Flush all caches in your database before import: in drupal interface (admin… or admin menu top left) or empty all caches in phpmyadmin… If not, and if you are using specific themes in sites/yourwebsite.com/themes, you could have blank pages because drupal will search for the template in the wrong file
• Missing images ›› need a query "replace" or "update" in your database to replace all src images from sites/DEFAULT/files into sites/YOURSITE.COM/files or use Search and replace module to do it in drupal interface. Do not forget the specific icon in Apparence, nor the blocks and pages that are not "scannarable" as front pages. Flush drupal and firefox caches.
• Missing attached images ›› change your file system path (in /admin/config/media/file-system): same as above. Flush drupal and firefox caches.
I did not find documentation on how to do this anywhere, so I decided to add it to this Wiki; which is the first place I checked for this solution. Feel free to suggest a better solution or modify this one if needed.