this is a situation that's been bugging me a lot the past few days. i have a lot of dev environment subdomains set up in my etc/hosts file like so...
127.0.0.1 localhost
127.0.0.1 sub.localhost
127.0.0.1 another.localhost
127.0.0.1 andanother.localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
and then specified in my Applications/MAMP/conf/apache/extra/httpd-vhosts.conf file, like so...
NameVirtualHost *:80
NameVirtualHost sub.localhost:80
NameVirtualHost another.localhost:80
NameVirtualHost andanother.localhost:80
<VirtualHost *:80>
DocumentRoot "/Users/johndoe/websites"
ServerName localhost
</VirtualHost>
<VirtualHost sub.localhost:80>
DocumentRoot "/Users/johndoe/websites/sub"
ServerName sub.localhost
</VirtualHost>
<VirtualHost another.localhost:80>
DocumentRoot "/Users/johndoe/websites/another"
ServerName another.localhost
</VirtualHost>
<VirtualHost andanother.localhost:80>
DocumentRoot "/Users/johndoe/websites/andanother"
ServerName andanother.localhost
</VirtualHost>
and just recently they all stopped working in Chrome (Firefox & Safari worked just fine). i started getting 404 errors for all of my localhost subdomains.
- editing/changing the settings in etc/hosts didn't work
- editing/changing the settings in my httpd-vhosts.conf file didn't work
i just couldn't figure out why Chrome was not resolving those addresses to those directories on my local machine.
.