Firefox - How to block a specific site?

Graham Todd grahamtodd2 at
Sat Jan 23 09:37:17 UTC 2010

On Fri, 22 Jan 2010 22:03:06 -0700
ANDY <sirald66 at> uttered these words:

> UBUNTU 9.10
> FIREFOX 3.5.7
> Using Firefox or /etc/hosts, I want to block/redirect
> How should I do that?
> ANDY - Salt Lake, UT

Short answer:

make sure you fire up your text editor in root mode, then
open /etc/hosts in the text editor.  Place an extra line *at the bottom*
of all your text as follows:


When you call a URL such as, your computer checks
your /etc/hosts file to find the IP it should look up for that URL;
if there's no Ip listed, your computer gets the IP no from your internet
service providers DNS servers, then connects you to the IP address, not
the URL.

By convention, the IP address of your computer is, so if you
list the relevant URL against the IP address of your computer, it will
try to find that URL on your computer, find its directed towards with which it can't connect as that's your computer, and the
website is not on your computer.

Now this is a handy way of blocking sites with which there may be
problems or content you do not want, and there is a text file regularly
updated which you can get from:

You have to remember to copy and paste the list *UNDERNEATH* the text
already in /etc/hosts (don't delete existing text).  There is one line
duplicated which is:		localhost

so delete that in the pasted section or comment it out (place hash
symbols ## in front), which will negate it, but since you already have
it listed, that's OK.

The upshot of this is that if you include in your /etc/hosts list:

the computer will try to find that webpage on your computer, be
unsuccessful, and not connect.

Graham Todd

More information about the ubuntu-users mailing list