Creating Multiple Virtual Sites on a WAMP Server

Open a directory named “habijabi” under your www directory, create index.html with some content under “habijabi” directory

1) Change your windows host file.

In my case it is: C:\Windows\System32\drivers\etc

There is a file named “hosts”

Open the file in notepad. say your desired domain name is habijabi.com

add the following line to end of the file:

127.0.0.1        habijabi.coms

Here “127.0.0.1” is your local pc IP

Save the hosts file.

2) Click on your wamp icon then, Apache->httpd.conf

The Apache config file should open in notepad

Find out Listen 80

Replace it with Listen *:80

Place the following code at the bottom of your httpd.conf file

NameVirtualHost *:80

<VirtualHost *:80>
ServerName localhost
DocumentRoot "D:\wamp\www"
</VirtualHost>
<VirtualHost *:80>
ServerName habijabi.coms
DocumentRoot "C:\wamp\www\habijabi"
<Directory "C:\wamp\www\habijabi">
allow from all
order allow,deny
AllowOverride All
</Directory>
DirectoryIndex index.html index.php
</VirtualHost>

Notice:

DocumentRoot "C:\wamp\www\habijabi"
<Directory "C:\wamp\www\habijabi">

These are your application directory where you want to point your domain habijabi.coms

3) Restart your WAMP server.

Go to the url http://habijabi.coms from your browser. you shod see the content, what you wrote on index.html file.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s