I have a hosts file that I've added a couple URLs to a while back and it's been working fine, but any new entries now get completely ignored. I've added these to test it...

google.com test-domain.com

google.com www.test-domain.com

And I've read through a bunch of posts about this issue. It makes no difference if I put them at the top or the bottom of the file, nor if I follow the entries with 2 carriage returns.

I'm totally at a loss. Any ideas?

  • 1
    You can't enter those values. That's not how the hosts file works. You need to direct an ip to a domain. You can't redirect based on domains. So you'll need to enter test-domain.com to have as the routable address when test-domain.com is entered into a browser (or other). – user10355 Jul 15 '13 at 22:28

As far as I'm aware, the /etc/hosts file on UNIX systems is intended to map IP addresses to hostnames and vice-versa. You have not added IP address information for these hosts.

See the man page for more information by typing the following at the command line:

man 5 hosts

You haven't specified how you are attempting to use this file or the records inside of it, so it's hard to say why it was working previously.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .