This question already has an answer here:

So I tried blocking some websites for obvious reasons but I can still keep going to these sites even when I 'supposedly' blocked them.

I've edited the /etc/hosts file so it looks like this (example being Facebook)       https://www.facebook.com       facebook.com       www.facebook.com

Yet I can still access Facebook. What am I doing wrong?

EDIT: Only Chrome seems to block out the website, though I can still access it trough Safari and Firefox.

I'm running OS X Yosemite

marked as duplicate by DavidPostill, LawrenceC, bwDraco, td512, Raystafarian Aug 10 '15 at 15:47

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • @Steven Still possible to acces the website – RandomPerson Aug 5 '15 at 16:03
  • 1
    @Steven is not same as, change it to and see if it works – pun Aug 5 '15 at 16:05
  • @Steven Still possible, I wanted to use so I didn't have to wait for the timeout. The question is towards unix systems. – RandomPerson Aug 5 '15 at 16:08
  • is a better option than – qasdfdsaq Aug 5 '15 at 16:21
  • @Steven I've updated the OP. Not a duplicate since it listens to the file, only in Chrome. I also have other sites in there that I need to disable to access certain files when not at work and re-enable them at work. That works. – RandomPerson Aug 5 '15 at 16:29

Use the following instead:      facebook.com      www.facebook.com

The IP address is the localhost, aka local loopback, address for your system. By using, you are telling your system that facebook.com's IP address is the address of your system itself, effectively making FaceBook unreachable, since the system will get the IP address for the site from the hosts file rather than performing a DNS lookup. The first entry you put in the file, https://www.facebook.com, doesn't belong there. The file provides a static mechanism for translating a fully qualified domain name (FQDN) to an IP address, so should only contain FQDNs or host names with associated IP addresses, not those prefixed by a protocol, such as HTTP, HTTPS, FTP, etc.

  • I've tried this before but it only works when using Chrome. If I tried to access the website with Firefox or Safari I would still be able to reach it – RandomPerson Aug 5 '15 at 16:15
  • 1 is nonsensical and inferior to – qasdfdsaq Aug 5 '15 at 16:22
  • 1
    @RandomPerson, Firefox has its own DNS cache. Clear the Firefox cache and try again. Safari may also be using a cached DNS entry. Rebooting would likely clear any cached entries. – moonpoint Aug 5 '15 at 16:24
  • 1
    @moonpoint Rebooted and cleared cache. Both still have access to the website – RandomPerson Aug 5 '15 at 16:29
  • @RandomPerson, what do you see if you ping facebook.com from within a Terminal window? You mentioned you are using Yosemite; when I added an entry to /etc/hosts on an OS X 10.8.5 (Mountain Lion) system, access was blocked. But there is a report of a similar problem on the Apple StackExchange site by someone running Yosemite at OS X 10.10.1 /etc/hosts & /private/etc/hosts file is being ignored and not resolving - see JB Smith's fix for blocking Facebook there. – moonpoint Aug 5 '15 at 17:37

Not the answer you're looking for? Browse other questions tagged or ask your own question.