Question

I am using MAMP. I want separate domains to use different roots on my local computer.

  • I want "localhost" to go to my htdocs folder.
  • I want "wowzers.loc" to use /Donald/Projects/wowzers as its root.
  • I want "secondsite.loc" to use /Donald/Projects/secondsite as its root.

Here is my httpd-vhosts.conf file:

NameVirtualHost *:80

<VirtualHost *>
  DocumentRoot "/Users/donald/Projects/wowzers"
  ServerName wowzers.loc
</VirtualHost>

<VirtualHost *>
  DocumentRoot "/Users/donald/Projects/secondsite"
  ServerName secondsite.loc
</VirtualHost>

Right now, typing "localhost", "wowzers.loc", or "secondsite.loc" will all navigate to the first entry in my vhosts file. In this example, everything navigates to "wowzers.loc".

Why do all my servernames point to the top entry?

Was it helpful?

Solution

You should try it without the quotes around DocumentRoot and also pass the same argument from NameVirtualHost to VirtualHost i.e.: <VirtualHost *:80>

Apache documentation

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top