Вопрос

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?

Это было полезно?

Решение

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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top