High on my list of priorities as we move towards our first real Drupal site was understanding how to setup multiple Drupal sites using the same core files. A lot of users have written on this subject and in the last couple of days I've read most of them. The alarming thing is that no two seem to be the same. The sad news is that I want to add to that growing list of multisite setups instructions.
The reason most of the posts proved unhelpful is that they assume you are creating different sites under different domains. For example, www.examplesite1.com and www.examplesite2.com will point to the same ip. But that wasn't what we were after. All our sites are under one domain. So we will create www.ourdomain.com/examplesite1/ and www.ourdomain.com/examplesite2/. The following instructions assume that you have already created a new alias in your Apache configuration file that points to your Drupal install.
In your Drupal 5 folder you will find a sites folder containing two folders ; "all" and "default". The "all" folder is for shared modules and themes that aren't part of the core but will be used with all your sites. The "default" folder contains a settings.php. If no other sites are found, based on your url, then the default folder is used. To create new sites using the same core you create new folders with their own settings.php file within the sites folder. The first important thing you need to know is that the folder name of your new sites need to reflect the address of the site with "." replacing "/" in the folder name. For example, if your site's url is http://localhost/test1/ then Drupal will look for a folder named localhost.test1. There are a few possible variations on this and they are described in settings.php. But what proved crucial for us was that you need to uncomment and change the $base_url variable to hold your full url without the trailing slash. Ours looked like this :
$base_url = 'http://localhost/test1';
This variable is optional in settings.php and for the senario of multiple domains for a single ip then it's probably doesn't need changing. But if you've done everything else and keep seeing the default site then you probably need to change this setting. We definitely did. Now to create a new site at this url you need to create a new empty database and assign priviledges. Add this information to settings.php as shown in the examples provided (in settings.php). Then navigate to install.php at the new sites url (e.g http://localhost/test1/install.php) and follow the usual install procedure. The result should be a shiny new Drupal website.