Nerdrium Home



Web Design

Case Mods





My Blog




Block Web Site Ads

by Michael Greifenkamp (February 6th, 2006)

For the most part I don't mind ads on web sites--it's part of doing business (if I don't want to see them I can always just not go to a particular web site, right?). Well, this morning a particularly irritating ad on was practically giving me a headache--zooming in and out and bouncing stuff around. Ick.

So I decided to make it go away. It's pretty simple, really.

First, I had to find the name of the server that was serving up the advertisements. By viewing the source in Safari I was able to determine that the server was Now I just needed to make it look somewhere else.

That's where the "hosts" file comes in handy. Open a terminal window, log in as root, and navigate to the /etc directory. I like to use the vi editor, so to edit the hosts file I typed vi hosts. At the bottom of the file I inserted "" This tells the network daemon that the ad server lives on my local machine, so it doesn't have to look up its real IP address using DNS.

I restarted Safari, emptied the cache, and lo and behold--my next visit to was ad free!