Drupal Multisite Tip - Compartmentalize

Drupal makes it easy to keep it simple

What hassle! File this one in the "Don't make the same mistakes I made" folder.

One (of many, IMHO) things that sets Drupal head and shoulders above other content management systems is the ease with which one Drupal code base can run multiple domains. The down side of this is that when something gets borked in your configuration, it can affect all of your sites. At that point, you might dedicate several frustrating days to deciphering error messages and slogging through tens of thousands of lines of code to unwind the mess.

Based on experience running six sites on separate domains from one Drupal installation, I want to share one bit of advice with Drupal admins, especially those configuring a fresh multisite:

For the love of Gawd, compartmentalize!

What do I mean by this? The directory structure for a multisite, as you should know, looks like this:

/sites
./all
../modules
../themes
./site1.com
../modules
../themes
./site2.com
../modules
../themes

etc.

It looks like that for darn good reason.

If you're an idiot (like me) you might be tempted to put most of your themes and modules in the "all" directory because, hey, you never know when you might want to add some feature or look to whatever site. DO NOT DO THIS!!! It will cause you untold pain down the road. Trust me.

If site1.com is a social networking site, you might want to install the Friend module (though I would recommend Buddylist instead). Install it in /site1.com's modules directory, not /all/modules. That way, if Buddylist conflicts with some other module, it will only affect site1.com. Compartmentalization also minimizes the chances of such conflicts occurring in the first place. Fewer modules on a given site ---> fewer chances for conflict. Make sense?

The same applies to themes. Less is more. A stitch in time saves nine. All that.

Set things up correctly from the word go. If you configure your multisite like I did, with too many modules and themes available to all sites, any solution to performance issues will be a hack. What I discovered was that once you install a module in the /all folder, it is well nigh impossible (or at least a major hassle) to move it to the individual site's directory. You end up having to back up that module's database tables, re-build and re-install the module, and import the data into the tables. Even that doesn't work sometimes, and even if it does, you'll have to repeat the tedious process many times to sort everything out.

So think about what you really need for a given site, not what you think you might want down the road. Install contributed modules and themes site-by-site. Take advantage of Drupal's elegant multisite configuration and compartmentalize.

Share/Save