Localhost is not working

If you have defined Virtual Hosts, and thats a very good idea, then you need to define the vhosts name in the HOSTS file.

For example, the hosts file:

127.0.0.1 localhost
::1 localhost

127.0.0.1 vhost1.dev
::1 vhost1.dev

127.0.0.1 vhost2.dev
::1 vhost2.dev

Otherwise windows has no way of knowing where to look for them.

Another possibility for localhost not working is a corrupted HOSTS file. Try deleting it and recreating it with an editor that is not notepad.

Also when you change the HOSTS file you need to restart the dmscache service ‘DNS Client’ by either rebooting or better still run a command window using “Run as Administrator” and do this

net stop dnscache
net start dnscache

that activates the new entries in your hosts file.

Leave a Comment