This is a systematic guide for configuring a multi-site environment on windows.

Assume Drupal installed and running properly. This is basically for those who are running Drupal under windows XP with Apache , PHP, MYSQL.

Step 1 - To create a sub-domain under windows

1.      Go the C:\WINDOWS\system32\drivers\etc  folder and open the ‘hosts’ file with notepad you’ll see something like this

# Copyright (c) 1993-1999 Microsoft Corp.

# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.

# This file contains the mappings of IP addresses to host names. Each

# entry should be kept on an individual line. The IP address should

# be placed in the first column followed by the corresponding host name.

# The IP address and the host name should be separated by at least one

# space.

# Additionally, comments (such as these) may be inserted on individual

# lines or following the machine name denoted by a '#' symbol.

#

# For example:

#      102.54.94.97     rhino.acme.com          # source server

#       38.25.63.10     x.acme.com              # x client host

127.0.0.1 localhost 

2.      Under the line 127.0.0.1.add another 2 lines like this

127.0.0.1 domain.localhost

127.0.0.1 subdomain.localhost (where subdomain is the name of the subdomain)

 

Now it look’s like this -

127.0.0.1 localhost 

127.0.0.1 domain.localhost

127.0.0.1 subdomain.localhost

Save it and close

 

3.      Now open the apache config file – it’l reside in the apache/conf folder

In my case (H:\webserver\xampp\apache\conf) and open the httpd.conf file with note pad, at the bottom of the file you will see something like this

#<VirtualHost *>

#    ServerAdmin webmaster@dummy-host.example.com

#    DocumentRoot /www/docs/dummy-host.example.com

#    ServerName dummy-host.example.com

#    ErrorLog logs/dummy-host.example.com-error_log

#    CustomLog logs/dummy-host.example.com-access_log common

#</VirtualHost>

Under that you add these lines

 

NameVirtualHost *:80

<VirtualHost *:80>

    DocumentRoot "H:/webserver/xampp/htdocs"

ServerName localhost

</VirtualHost>

<VirtualHost *:80>

    DocumentRoot "H:/webserver/xampp/htdocs "

ServerName subdomain.localhost

</VirtualHost>

Note: in my case document root is H:/webserver/xampp/htdocs. Change it according to your corresponding document folder.

Save it and close it. (You need to restart your system for you subdomain to work)

Step-2

1)      Got to Drupal sites folder

Ex: H:\webserver\xampp\htdocs\sites

Create a new folder with the name of the subdomain - subdomain.localhost

2)      Now you will be having two folders in your site directory

a.       Default

b.      Subdomain.localhost

 

3)    Copy the settings.php file in the default directory to subdomain.localhost

Create another database in your mysql using php and copy the database.mysql from database directory (through PHPmyadmin easy way)

And provide those database details in your new settings.php (in subdomain.localhost folder) the change the base url to http://subdomain.localhost”

Save the file and close.

Point your browser to http://subdomain.localhost and have a new site from single codebase.

Feel free to contact me.