In the file: C:\wamp\bin\apache\Apache2.2.11\conf\extra\httpd-vhosts.conf
Find: NameVirtualHost *:80 Replace with: NameVirtualHost *
In the file: C:\wamp\bin\apache\Apache2.2.11\conf\httpd . conf
Find: #Include conf/extra/httpd-vhosts.conf and delete the #
Location: C:\Windows\System32\drivers\etc\hosts
For Each Website you will need to insert the following: 127.0.0.1 www.tanmay.org
127.0.0.1 represents the IP for your localhost.
C:\wamp\bin\apache\Apache2.2.11\conf\extra\httpd-vhosts.conf
For Each Website add the following:
<VirtualHost *>
ServerName www.tanmay.org
DocumentRoot “ C:/wamp/www/
”
</VirtualHost>
If you have a website which run’s multiple domains, you can add Alises. This time you would add another ServerAlias for each website:
<VirtualHost *>
ServerName www.tanmay.org
ServerAlias www.tanmay.com
ServerAlias www.tanmay.in ServerAlias www.tanmaysarkar.in
DocumentRoot “
X:/my/folder/path/”
</VirtualHost>
But you should write it in hosts file also, like,
127.0.0.1 www.tanmay.com 127.0.0.1 www.tanmay.in 127.0.0.1 www.
tanmaysarkar.in
That’s it!
*note
It must be present in httpd-vhosts.conf before your vhost conf, other wise it through 403 error.
<VirtualHost *>
ServerAdmin webmaster@localhost
DocumentRoot “c:/wamp/www”
ServerName localhost
ErrorLog “logs/localhost-error.log”
CustomLog “logs/localhost-access.log” common
</VirtualHost>
A good virtual host example –
<VirtualHost *>
ServerAdmin webmaster@abcxyz.in
ServerName www.abcxyz.in
ServerAlias abcxyz.in
ServerAlias abcxyz.co.in
DocumentRoot “D:/my_project/abcxyz/”
ErrorLog “logs/abcxyz-error.log”
CustomLog “logs/abcxyz-access.log” common
<directory “D:/my_project/abcxyz/”>
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
#Deny from all
Allow from 127.0.0.1
</directory>
</VirtualHost>