It would not work and as soon as I tried to modify it, I get Access denied within notepad - even opening up as Administrator. The problem ended up being that AVG (corporate version) detected the HOSTS file as a possible virus and blocked access to it. Here is the same problem on AVG 9 Free:
a) Trying to block access to sites via hosts is a silly idea, I have no idea how it started.
If I wanted to get to Facebook, I could still just as easily visit http://188.8.131.52 ... blocking access to the IPs via a perimeter firewall is a lot more effective.
b) Why are you putting 'http://' in your hosts file? hosts is for DNS look-ups, which is entirely independent from HTTP.
I was able to edit the HOSTS file and I was performing a test. I added the following lines and saved it:
a: It's not a silly idea. I could be teaching a class; I could be experimenting with Anti-virus behavior; I could be doing an exercise for a class; I could be a Microsoft Beta Tester; I could be an AVG Beta Tester
Just tried the following.
Edited hosts to:
Opened Internet Explorer, typed in letheonline.net and this goes to 184.108.40.206 which is Google.
No McFly, I added letheonline.net to the HOSTS file and went to letheonline.net and it worked as expected, but if I try it with http:// or www. it does not work, it ignores that entry and proceeds to the website. So that's why I also added with www. and http., these were simple tests to monitor how the file gets used, and what processes use it, etc.,
What is pretty irritating is that in this forum there is always some member that somehow gets annoyed when somebody else posts simple info on a problem they face. Immediately they have to give out their opinion about it, or say what they think. "Trying to block access to sites via hosts is a silly idea" - It may seem that way to you and I completely understand, trust me I see people post very silly things, but I am sure as silly as it is, it's helped thousands to get the job done.
Not trying to start a flame war here, but a simple "Thanks for sharing this info" would have been more welcoming. I struggled with this problem for hours as nobody had any info on it, anywhere, and I posted it here so there would be some info to help others. That's all I'm trying to do.
Sorry but that's just not what's happening. And I'm not trying to post bogus information, that's probably your excuse to get angry and start cursing and fighting, as you just did. I'm posting exactly whats happening on several machines (just tried again), not stuff I'm making up to try and fool others (since that's the real meaning of bogus right?).
I even flushed out the DNS Cache, tried this out in two computers in two different locations, three different browsers, same thing...exactly as I describe it.
I seriously hope the ADMINS are watching this thread - because this is the exact same reaction I get almost everytime I try to help on these forums and hence the reason why I'm barely on here anymore. This is what happened last time, yet I still get emails of people joining this forum just to say thanks for "posting that" or "sharing that info" and how it's helped them out. I just don't get the aggression and so much anger...I'm just trying to help...nothing else.
You should be ending up at Google. There should be a request to your DNS server, "what's the IP for letheonline.net?" ... but it first consults your hosts file. So it sees that it already knows the IP (220.127.116.11), and thus doesn't have to ask your DNS server. So you should end up at Google. Okay, so you're not. Something else is going on then.
Joshua Marius, LeThe (34532) said on Jul 28, 2010 at 09:23am PDT:
Immediately they have to give out their opinion about it, or say what they think. "Trying to block access to sites via hosts is a silly idea" - It may seem that way to you and I completely understand, trust me I see people post very silly things, but I am sure as silly as it is, it's helped thousands to get the job done.
Opinions are a good thing. I will say this again, trying to block access to sites that way is silly. It's simply not how it's supposed to be done. That's not the purpose of the hosts file. This contrasts with trying to block http:// individually in your hosts file, which is just plain wrong.
127.0.0.1 block-this-site-plz.com # will work, but improper and easily bypassed
127.0.0.1 http://block-meee.com # won't work, because hostnames don't contain http:// !!
In my first reply, I didn't just say "it's silly." I gave you an example of just how easy it is to bypass, as well as a more effective alternative. I just really hope you're not employing that method of blocking a site in an IT capacity, because it's amatuer-hour at best.