Je ne suis pas sûr de ce qui se passe ici, mais j'utilise MAMP 1.9 sous MAC OS X. Dans mon fichier httpd.conf, DocumentRoot est défini sur le chemin htdocs par défaut. Dans le dossier htdocs, j'ai créé un certain nombre de "sous-sites" dans le but de les configurer en hôtes virtuels .... Je peux accéder aux chemins spécifiés, mais ils semblent tous par défaut être le premier que j'ai mis en place .MAC OS X: environnement MAMP et hôtes virtuels
Essentiellement, le premier VirtualHost que j'ai configuré était pour site1.localhost.com. J'ai depuis configuré site2.localhost.com et site3.localhost.com. Cependant, aller à l'une des deux dernières adresses, semble toujours me rediriger vers site1.localhost.com. De plus, aller juste localhost.com:8888 tire aussi sur site1.localhost.com. Je ne sais pas où j'ai fait un faux pas, mais j'espère que quelqu'un ici sera capable de m'aider à comprendre le problème ... Oh, et j'ai redémarré apache etc., après tout changement apporté au/etc/hosts ou fichier httpd.conf.
Dans mon fichier httpd.conf (les parties pertinentes, en tout cas ...):
#
# 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>
Dans mon/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
ahhh merci! ça me rendait fou !! – locrizak