When I edit my hosts file to redirect a URL to a specific IP address, nothing happens. My hosts file looks like this - zionica.com this is in the directory /private/etc/hosts. I am not all that familiar with the Terminal nor it's commands so I'm having difficulty troubleshooting my problem.

The one thing I can think of is that I followed the following tutorial in an attempt to have SwitchHosts work in Firefox. https://addons.mozilla.org/en-US/firefox/addon/switchhosts/reviews/286862/ Is there a way to reverse these steps? Would that even solve my problem?


Try running dscacheutil -flushcache as it sounds like it's not correctly doing flushing the cache to update it.

  • 1
    Thank you for your response! I've actually tried running that command numerous times but with no results. – Jacob Lamont Sep 23 '11 at 15:55
  • Ah, thought we might get lucky and find that it was a simple one. So if you've run switchhosts your hosts file now exists outside of /etc (kind of). The ln command creates a symbolic link between the files so /etc/hosts points to <username>/hosts. OS X reads /etc/hosts first and it's normally a symlink to /etc/private/hosts, so editing /etc/private/hosts won't update /etc/hosts. You can either edit the hosts file in <username>, or /etc/hosts and that should do it. – Nicholas Smith Sep 23 '11 at 16:38
  • Ok, so I tried editing the hosts file in <username> by typing the command nano hosts from within my <username> directory. I also tried editing the one in the 'etc' directory by typing nano /etc/hosts from within my <username> directory. Both files now have zionica.com www.zionica.com in them. It still doesn't work - the page points to the original IP address; not the one defined in my hosts file. – Jacob Lamont Sep 23 '11 at 20:36
  • Try deleting the hosts files found at <username>/ and /etc, then cp the /etc/private one over into /etc with sudo. It'll break that SwitchHosts thing, but might resolve your issue. – Nicholas Smith Sep 23 '11 at 22:33

Note that zionica.com and www.zionica.com (or any other subdomain that comes before the word zionica) is a different domain, and the line as listed will not trap everything automatically by listing only the Second Level Domain.


www is a third-level domain, more commonly referred to as a 'sub-domain'.
zionica is the second-level domain. This word/placement on it's own generally does not have a more specific name.
com is a Top-Level Domain (TLD). Just like co, cc, org, net, ca, jp, uk, me, info, etc. (Everything except etc is a TLD.)

You can stuff multiple names into a single IP address line, so this is valid: zionica.com www.zionica.com

  • Thank you for your response. Unfortunately, it didn't end up solving my problem - but it was very helpful info! I wouldn't pass up the opportunity to learn something! – Jacob Lamont Sep 23 '11 at 20:01

You must log in to answer this question.

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