A few days ago, Safari started giving me the error message that it can't load http://www.google.com because the server www.google.com could not be found. I searched and read about every forum dating back to 2007 on how to fix this and all of the solutions did not work on my computer.
I am running an iMac with Core 2 Duo 2.66 GHz.
The problem existed in Safari, Chrome, FireFox and Opera
The problem existed after I created and logged in to a new account
Emptied all caches, histories
Reset cable modem and Time Capsel several times in various orders
Reset IP addresses and changed Proxies on and off
Tried various DNS configurations
Downloaded and installed MacKeeper and wiped out Caches and unneccessary files
Ran virus scaner and only found one infected file (an .exe that I copied over from my PC years ago - it wouldn't run anyway)
Purchased and installed Lion
Always the same result, I can go to any website except ones that had "www.google" in them. Then I ran across the host lookup command in termanal so did an internet search for host files for Mac. I found this site "http://www.mactricksandtips.com/2009/02/editing-a-macs-hosts-file.html" that explains where this file is located. I found the file and opened it in texteditor and it contained the following.
# Host Database
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
When I would type in the IP address, I would get the error message above. So now the plot thickens, I could not modify the file because it was locked. I had to use the "Get Info" option in order to give myself permission to edit the file. Then had to change permissions on the /ect director and the /private directory before I could edit and save the file without all the google llines. I closed Safari and re-opend and Bam, Google was back.
The Host file is a system file with only the wheel and system being able to edit it.
So the big question - what modified the file and why just the google sites?