Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.

Thanks,

CNET Support

General discussion

Blocking websites

Jun 15, 2007 2:33AM PDT

Is is possible to block a website so that it will redirect to the 404 page not found screen? I thought someone on here might know if it was possible.

Discussion is locked

- Collapse -
It can be done by
Jun 15, 2007 2:36AM PDT

editing the HOST file.

I don't have the details right now, XP at work, but if you get no other answers, I'll check when I get to the house.

P

- Collapse -
Thanks
Jun 15, 2007 6:34AM PDT

I knew it had something to do with editing host files but I don't know where to find them.

- Collapse -
A place to find instructions and tips
Jun 15, 2007 10:45AM PDT

This site is the best one I can find for step by step instructions on how to edit the Hosts file in OS X
Starting from 10.3 the OS has consulted the Hosts file before going to DNS. By editing the Hosts file you can make the request end up on the local machine and display a 404 error.

http://everythingisnt.com/hosts.html

I have never done this myself but it "seems" fairly straight forward if you read ALL the instructions,.

Good luck

P

- Collapse -
block sites.
Jun 22, 2007 2:11PM PDT

create your custom 404 html, and name it index.html and put in your sites folder
enable websharing in system prefs.


Open Terminal
Type this

cd..
cd etc
sudo vi hosts

press i

type this on a new line

the.ip.of.the.host the ip.of.your.machine


press esc
press :wq
press return

restart