Oct 22 / Richard Knop

WAMPSERVER 2.0: adding virtual hosts

I often need to test several Zend Framework projects on my local machine (I’m running Windows Vista and WAMPSERVER 2.0). To do that, I just create a virtual host for every project. There are just two files you have to modify:

  • C:\wamp\bin\apache\Apache2.2.11\conf\httpd.conf
  • C:\Windows\System32\drivers\etc\hosts

Paths to those files may differ on your PC, depends on the installation.

For instance, you might want to save your Zend Framework project to “C:\wamp\www\myproject” and access it with “http://myproject”. Add this at the end of the httpd.conf file:

NameVirtualHost *:80
<VirtualHost *:80>
    ServerName myproject
    DocumentRoot "C:\wamp\www\myproject"
</VirtualHost>

Now open the hosts file and write on the last line:

127.0.0.1    myproject    # my cool ZF project

Restart all services and it should work.

Leave a Comment