Running multiple sites on a local PC (localhost) from a single codebase, using Windows
Here's how to get mutltiple sites working on localhost using Windows XP. This should work with Drupal 4.6.x and assumes that you have PHP, Apache, MySQL, phpMyAdmin and Drupal all installed and working.
There are four stages to go through, but it's not difficult:
1. Set up your databases, one for each website
2. Set up each website in Drupal
3. Edit the virtual host settings in Apache
4. Update the Windows hosts file
In the following example we will add a local site"http://testsite1" in addition to the default site. We'll assume Drupal is installed in c:/www (and that your web root is set to c:/www in the apache confic file).
Databases
=========
Firstly we will set up a new database for 'testsite1'
1. Open your phpMyAdmin page
2. Type a name for your database in the 'create database' textbox ('testsite1' is as good as anything) then click the create button. You should get a message to say your database is created.
3. Next we need to add the necessary tables. Click the 'sql' tab, then use the browse option to navigate to the 'includes' folder of your Drupal installation, e.g. c:/www/drupal-4.6.3/includes. Select the file 'database.mysql.inc' then 'go'.
4. phpMyAdmin will run the script and install the necessary tables.
Drupal
======
1. Make a copy of the folder /sites/default and call it /sites/testsite1. i.e. you should now have two folders in your sites folder, default and testsite1.
2. Open file sites/testsite1/settings.php using notepad. Edit the $db_url line to match the database defined in the previous steps:
$db_url = "mysql://username:password@localhost/database";
where 'username', 'password', 'localhost' and 'database' are the
username, password, host and database name for your set up.
3. Set $base_url to match the address to your Drupal site:
$base_url = "http://testsite1";
4. Save the file.
Apache
======
1. Open the apache config file 'http.conf' (it's in the apache/conf folder in Apache 1. I think it has moved somewhere else in Apache2)
2. Scroll to the end of the file, where you will find the virtual hosting setup. Assuming your websites are all located in the folder c:/www then add the following lines (edit the paths as necessary)
NameVirtualHost 127.0.0.1:80
<VirtualHost 127.0.0.1:80>
DocumentRoot "C:/www/"
ServerName localhost
</VirtualHost>
<VirtualHost testsite1>
DocumentRoot "C:/www/Drupal-4.6.3"
ServerName testsite1
</VirtualHost>There are lots of other things you can add into your VHost settings - see the Apache documentation.
Windows
=======
We now need to tell Windows that the domain 'testsite1' is hosted locally, i.e. not to look on the Internet for it. Open the 'hosts' file with notepad. It can usually be found in c:/windows/system32/drivers/etc
Edit the end of the file to read:
127.0.0.1 localhost
127.0.0.1 testsite1
Save the file.
Apache, again
=========
OK, that's (almost) it. All that is left is to restart the Apache webserver. You could reboot your computer but a better way is to open a command prompt window (a DOS window as we used to call it) and type 'net stop apache'. When the service has stopped, restart it using 'net start apache'
Now when you open your favourite browser and enter 'http://testsite1' you should see your shiny new Drupal site, just waiting to be customised.
You can add as many sites as you need by following the process above.

Add sites as subdomains of localhost, XAMPP config
Notes:
1. It's also possible to add sites as subdomains of localhost. Configuration is similar. Advantage: it's easier to distinguish between the local and the remote site if they have the same name.
2. I've tried running multiple sites from the same codebase using XAMPP. Here are my XAMPP multisite config tips.
Amnon
-
Drupal Focused Search Engine | Drupal Israel
Personal: Hitech Dolphin: Regain Simple Joy :)