Multi-site on Windows

Alternatively, you can install another WAMP package, but you will need to adjust the paths as necessary.

Process

Set up Drupal as usual

Install WampServer (or another ‘WAMP’ package) and make sure that Apache and MySQL services are running.

open phpMyAdmin in your browser localhost/phpmyadmin (or it can be launched via the WampServer icon in your system tray.)

Create a new database — we’ll call it drupal6 because this will be our base installation which we will leave untouched. While you’re here create a second and third database, which we’ll call site1 and site2. You can also change the database privileges if you want, but to keep things simple here, we’ll stick with the default user root and no password.

Download Drupal 6 into WampServer’s wamp/www folder (or the htdocs folder in Xampp and some other packages). (You’ll need a tool like 7-zip to unpack the Drupal tar.gz file).

Do your first Drupal installation by pointing your browser to your Drupal folder, which should be something like http://localhost/drupal-6.x. Enter the drupal6 database and user settings (root and no password in this example). Complete the installation, but then leave it alone.

Prepare the files for your new multi-sites

Find Drupal’s sites folder, make a copy of the default folder and rename it to the URL you want for your first test site. To keep it simple, we’ll make it the same as the first test site database: site1. While you’re here, create files,tmp and themes sub-folders within this new folder. The themes sub-folder will be used for any custom theme you create specifically for this site. Similarly, you can create a modules sub-folder for any module you use only with this site. However, generally, I find it easier to keep all contributed modules together in the sites/all/modules folder so I can use them with all my test sites.

Use a text editor to open the settings.php file in your new site1 folder and change$db_url line to reflect your first test site database, and the database user name and password, eg:mysql://username:password@localhost/site1
Also, change the $base_url to the above site URL, eg:$base_url = 'http://site1'; // NO trailing slash!

Repeat the above 2 steps for the other test site (site2)

Adjust windows so it can find the new site at a new made-up nameFind the Windows hosts file, which should be in Windows’ System32/drivers/etc folder, make a backup of that file and then open the hosts file in a text editor. Here, add new lines mapping your localhost IP address to match the URLs of your test sites and your original Drupal site. In our example, it would look like this:

127.0.0.1 localhost
127.0.0.1 site1
127.0.0.1 site2
127.0.0.1 drupal6

This is telling Windows Networking that http://site1/is a name for this machine.

Adjust Apache so it responds to requests for the new names

Find the Apache httpd.conf file which, in WampServer, should be in thewamp/bin/ApacheX.X/conf folder (where X.X is the Apache version number). Sorry, I can’t remember where Xampp installs this, but it will be in the Apache folder. Anyway, all you need to do with this file is make sure the “Virtual hosts” line is active by removing the # before Include conf/extra/httpd-vhosts.conf.

Make a backup of that httpd-vhosts.conf file (which is in Apache’s conf/extrafolder), then open httpd-vhosts.conf with a text editor and add these lines:

where C:/wamp/www/drupal-6.x is the path to the Drupal installation folder andsite1 is the URL for your first test site. Add another entry for your other test site, another entry for your original Drupal installation and another entry for WampServer’s localhost URL (if you want to keep this active), eg:

And that’s it. You can access your two test sites anytime WampServer is running by using the http://site1 and http://site1 URLs.

As I said, it’s not exactly simple, but it is well worth the effort. Now you can do whatever you like with your test sites. If you mess up with, say, site1, just delete the site1 folder, thesite1 database in phpMyAdmin and the site1 entries in the Windows hosts and Apachehttpd-vhosts.conf files and start again. Alternatively, if a site works out and you want to go live with it, the multi-site approach makes this easier (in my opinion).
One final caveat: I’m no expert. This technique works for me (apart from one corporate environment with a particularly annoying proxy server), but I’d welcome any feedback, especially if there are any accuracies.