Multiple Virtual Hosts on Localhost of Apache / WAMP

Submitted by Anonymous (not verified) on Sun, 10/24/2010 - 13:58

You want to test multiple domains/sites on your local computer. Each site need to run on root level without urls without subdirectory. You have to create multiple vhosts. For each virtual host creata an entry in windows host file: hosts
Run a text editor as administrator to have right to make changes under windows.

C:\Windows\System32\drivers\etc\hosts :

127.0.0.1       www.mysite1.example
127.0.0.1       www.example.ku

httpd.conf :

NameVirtualHost 127.0.0.1

<VirtualHost 127.0.0.1>
    DocumentRoot C:\web\mysite1\public_html
    ServerName www.mysite1.example
</VirtualHost>

<VirtualHost 127.0.0.1>
    DocumentRoot C:\web\mysite2\www
    ServerName www.example.ku
</VirtualHost>

<VirtualHost 127.0.0.1>
    DocumentRoot C:\web
    ServerName localhost
</VirtualHost>

Add new comment