2

If you're reading my question, thanks, I appreciate your help

I'm using Wamp on Windows Vista.

I've created 2 project folders:

www/project1/ 
www/project2/

My virtual hosts file looks like this:

NameVirtualHost *:80

<VirtualHost *:80>
    DocumentRoot "C:/wamp/www/project1/"
    ServerName project1.com
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "C:/wamp/www/project2/"
    ServerName project2.com
</VirtualHost>

Can someone advise how I can go about doing this?

Chris
  • 132
  • 2
  • 7

2 Answers2

3

You need to specify ServerName in VirtualHost like this (and additionally ServerAlias) for each hostname:

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.localhost
    DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host1.localhost"
    ServerAlias *.first.com first.com
    ServerName www.first.com
    ErrorLog "logs/dummy-host1.localhost-error.log"
    CustomLog "logs/dummy-host1.localhost-access.log" common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.localhost
    DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host2.localhost"
    ServerAlias *.second.com second.com
    ServerName www.second.com
    ErrorLog "logs/dummy-host2.localhost-error.log"
    CustomLog "logs/dummy-host2.localhost-access.log" common
</VirtualHost>
David Kuridža
  • 7,026
  • 5
  • 26
  • 25
  • Sorry pal, but what you're suggesting isn't working for me. See my Edit above in the original post. If you can help out from there, that would be great. – Chris Oct 04 '09 at 12:03
  • 1
    Hosts file must map first.com and second.com to localhost: 127.0.0.1 first.com 127.0.0.1 second.com You need to make sure your local DNS is refreshed as welll; restart browser and restart dnscache service. – David Kuridža Oct 04 '09 at 13:38
3

Here is a full tutorial, hope it helps. Let me know if you run into any problems.

http://kintek.com.au/blog/configuring-multiple-domains-within-wamp-for-local-development/

unloco
  • 6,928
  • 2
  • 47
  • 58
Maurice
  • 468
  • 6
  • 13