Я не уверен, что происходит здесь, но я выполняю MAMP 1.9 на Mac OS X. В моем httpd.conf файле DocumentRoot установлен на значение по умолчанию htdocs путь. В htdocs папке я создал много "подсайтов", чтобы настроить их как Виртуальные Хосты.... Я могу добраться до указанных путей, но они все, кажется, принимают значение по умолчанию к первому, которого я настроил.
По существу первый VirtualHost, который я настроил, был для site1.localhost.com. Я с тех пор настроил site2.localhost.com и site3.localhost.com. Однако идя в любой из последних двух адресов, всегда, кажется, перенаправляет меня на site1.localhost.com. Кроме того, движение только к localhost.com:8888 также просто тянет site1.localhost.com. Я не уверен, где я сделал оплошность, но надо надеяться кто-то здесь сможет помочь мне выяснить проблему... О, и я перезапустил апача и т.д., после того, как любые изменения сделали или к/etc/hosts или к httpd.conf файлу.
В моем httpd.conf файле (соответствующие части, так или иначе...):
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
# MAMP DOCUMENT_ROOT !! Don't remove this line !!
DocumentRoot "/Applications/MAMP/htdocs"
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/Applications/MAMP/htdocs">
<VirtualHost *>
DocumentRoot "/Applications/MAMP/htdocs/site1/"
ServerName site1.localhost.com
</VirtualHost>
<VirtualHost *>
DocumentRoot "/Applications/MAMP/htdocs/sub/site2/"
ServerName site2.localhost.com
</VirtualHost>
<VirtualHost *>
DocumentRoot "/Applications/MAMP/htdocs/sub/site3/"
ServerName site3.localhost.com
</VirtualHost>
В моем/etc/hosts файле:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
127.0.0.1 site1.localhost.com
127.0.0.1 site2.localhost.com
127.0.0.1 site3.localhost.com
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost