# IE ignores HOSTS file/ other ways to block web sites?

**URL:** <https://boards.straightdope.com/t/ie-ignores-hosts-file-other-ways-to-block-web-sites/440698>\
**Category:** Factual Questions\
**Created:** [March 9, 2008, 5:35am UTC](https://boards.straightdope.com/t/ie-ignores-hosts-file-other-ways-to-block-web-sites/440698 "2008-03-09T05:35:52Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![neutron\_star](https://avatars.discourse-cdn.com/v4/letter/n/51bf81/32.png) [@neutron\_star](https://boards.straightdope.com/u/neutron_star)\
**Post date:** [March 9, 2008, 5:35am UTC](https://boards.straightdope.com/t/ie-ignores-hosts-file-other-ways-to-block-web-sites/440698/1 "2008-03-09T05:35:52Z")

</div>

I’m trying to block a certain user from viewing certain sites on a computer running WinXP SP2. If all users are unable to view the sites, that’s fine too.

I made entries like this in the hosts file, using Yahoo as a test:  
127.0.0.1 [yahoo.com](http://yahoo.com)

And I saved it. I’m still able to view [yahoo.com](http://yahoo.com), though.

I searched for some tips and based on what I found, I ran the “ipconfig /flushdns” command, I completely cleared the browser cache, and I also rebooted. No dice. IE still loads the page. When I try to PING [yahoo.com](http://yahoo.com) from a command prompt, it looks for it on the localhost like it should, but IE7 simply refuses to cooperate.

Also, failing this, is there any other way to block specific web sites in IE without installing any other programs?

---

<div class="post-metadata">

**Author:** ![aldiboronti](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@aldiboronti](https://boards.straightdope.com/u/aldiboronti)\
**Post date:** [March 9, 2008, 5:59am UTC](https://boards.straightdope.com/t/ie-ignores-hosts-file-other-ways-to-block-web-sites/440698/2 "2008-03-09T05:59:49Z")

</div>

Go to Internet Options in IE7, click on the Content tab at the top, Enable the Content Advisor, click on the Approved Sites tab. Enter the website you want blocked and click Never. Repeat for as many sites as you wish.

There’s a page [here](http://teamtutorials.com/windows-tutorials/internet-explorer-7-content-advisor-setup) which leads you through the process.

---

<div class="post-metadata">

**Author:** ![Noone\_Special](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/noone_special/32/2863_2.png) [@Noone\_Special](https://boards.straightdope.com/u/Noone_Special)\
**Post date:** [March 9, 2008, 6:31am UTC](https://boards.straightdope.com/t/ie-ignores-hosts-file-other-ways-to-block-web-sites/440698/3 "2008-03-09T06:31:57Z")

</div>

[QUOTE=neutron star]  
I’m trying to block a certain user from viewing certain sites on a computer running WinXP SP2. If all users are unable to view the sites, that’s fine too.

I made entries like this in the hosts file, using Yahoo as a test:  
127.0.0.1 [yahoo.com](http://yahoo.com)

And I saved it. I’m still able to view [yahoo.com](http://yahoo.com), though.

I searched for some tips and based on what I found, I ran the “ipconfig /flushdns” command, I completely cleared the browser cache, and I also rebooted. No dice. IE still loads the page. When I try to PING [yahoo.com](http://yahoo.com) from a command prompt, it looks for it on the localhost like it should, but IE7 simply refuses to cooperate.

Also, failing this, is there any other way to block specific web sites in IE without installing any other programs?  
[/QUOTE]

This sounds wrong… the “hosts” file is low-level – lower than the browser asking for an address.

Did you make sure to call the file – just – “hosts”? Not “hosts.txt”, not anything with a suffix, just “hosts” without anything else?

Did you place it in C:\WINDOWS\system32\drivers\etc?

Did you access yahoo as “[yahoo.com](http://yahoo.com)” (the exact way you put it in the “hosts” file) or is your shortcut pointing at “[www.yahoo.com](http://www.yahoo.com)” or somesuch? If the latter, then putting “[yahoo.com](http://yahoo.com)” in your “hosts” file still won’t do anything.

Just a few ideas OTTOMH.

Also - what **aldiboronti** said. Probably a better idea than playing with the “hosts” file.

---

<div class="post-metadata">

**Author:** ![neutron\_star](https://avatars.discourse-cdn.com/v4/letter/n/51bf81/32.png) [@neutron\_star](https://boards.straightdope.com/u/neutron_star)\
**Post date:** [March 9, 2008, 6:59am UTC](https://boards.straightdope.com/t/ie-ignores-hosts-file-other-ways-to-block-web-sites/440698/4 "2008-03-09T06:59:22Z")

</div>

[QUOTE=Noone Special]  
This sounds wrong… the “hosts” file is low-level – lower than the browser asking for an address.

Did you make sure to call the file – just – “hosts”? Not “hosts.txt”, not anything with a suffix, just “hosts” without anything else?

Did you place it in C:\WINDOWS\system32\drivers\etc?  
[/quote]

Yes, and yes.

> [@](#):
>
> Did you access yahoo as “[yahoo.com](http://yahoo.com)” (the exact way you put it in the “hosts” file) or is your shortcut pointing at “[www.yahoo.com](http://www.yahoo.com)” or somesuch? If the latter, then putting “[yahoo.com](http://yahoo.com)” in your “hosts” file still won’t do anything.

Could be this. I can’t check right this moment because a co-worker is using the computer in question. I’m not sure I understand how blocking the entire domain [yahoo.com](http://yahoo.com) fails to block the subdomain [www.yahoo.com](http://www.yahoo.com), though. 😕

> [@](#):
>
> Also - what **aldiboronti** said. Probably a better idea than playing with the “hosts” file.

Yeah, I figured this out through a web search shortly after I posted my question. Thanks, though, **aldiboronti**. I would prefer it to look like the site just wasn’t responding or something so I don’t have the creepy guy at work who browses assault rifle sites all night start questioning me about blocking them, but I guess he would have figured it out eventually anyway.

---

<div class="post-metadata">

**Author:** ![Noone\_Special](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/noone_special/32/2863_2.png) [@Noone\_Special](https://boards.straightdope.com/u/Noone_Special)\
**Post date:** [March 9, 2008, 7:13am UTC](https://boards.straightdope.com/t/ie-ignores-hosts-file-other-ways-to-block-web-sites/440698/5 "2008-03-09T07:13:06Z")

</div>

[QUOTE=neutron star]  
I’m not sure I understand how blocking the entire domain [yahoo.com](http://yahoo.com) fails to block the subdomain [www.yahoo.com](http://www.yahoo.com), though. 😕  
[/QUOTE]  
Because the “hosts” file, as stated, is rather low-level. It’s just used as a textual lookup – if the **exact** text of the Internet Address\*\* that you type exists in column 2, it uses the IP Address in column 1; otherwise, it uses whatever DNS server is configured or default to figure it out.

\*\*everything between the “[protocol]://” at the beginning (if there is one) and the “:” (if there’s a specific port), or the “/”, or the end of the address) – E.g., if you type “[http://www.yahoo.com:80/index.html](http://www.yahoo.com:80/index.html)”, the “Internet Address” portion that gets resolved is “[www.yahoo.com](http://www.yahoo.com)”. Having “[yahoo.com](http://yahoo.com)” in your “hosts” file won’t do any good – it’s not the same string!

---

<div class="post-metadata">

**Author:** ![Derleth](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@Derleth](https://boards.straightdope.com/u/Derleth)\
**Post date:** [March 10, 2008, 2:08am UTC](https://boards.straightdope.com/t/ie-ignores-hosts-file-other-ways-to-block-web-sites/440698/6 "2008-03-10T02:08:36Z")

</div>

**aldiboronti** : Except that can be undone by anyone even minimally clueful, whereas the hosts file is (theoretically) protected by the filesystem and permissions model.\*

In short, IE7 is broken.

\*(Or is Windows so broken even that is not guaranteed?)

---

<div class="post-metadata">

**Author:** ![Joey\_P](https://avatars.discourse-cdn.com/v4/letter/j/919ad9/32.png) [@Joey\_P](https://boards.straightdope.com/u/Joey_P)\
**Post date:** [March 10, 2008, 3:00am UTC](https://boards.straightdope.com/t/ie-ignores-hosts-file-other-ways-to-block-web-sites/440698/7 "2008-03-10T03:00:51Z")

</div>

First of all, anything I put in the hosts file, I put in as (for yahoo) both [yahoo.com](http://yahoo.com) AND [www.yahoo.com](http://www.yahoo.com) as separate lines.  
Second, at this point, you’ve probably done this anyways, but if you save the hosts file while IE is open, you have to close all instances of it and reopen it.

---

<div class="post-metadata">

**Author:** ![Joey\_P](https://avatars.discourse-cdn.com/v4/letter/j/919ad9/32.png) [@Joey\_P](https://boards.straightdope.com/u/Joey_P)\
**Post date:** [March 10, 2008, 3:03am UTC](https://boards.straightdope.com/t/ie-ignores-hosts-file-other-ways-to-block-web-sites/440698/8 "2008-03-10T03:03:04Z")

</div>

First of all, anything I put in the hosts file, I put in as (for yahoo) both [yahoo.com](http://yahoo.com) AND [www.yahoo.com](http://www.yahoo.com) as separate lines.  
Second, at this point, you’ve probably done this anyways, but if you save the hosts file while IE is open, you have to close all instances of it and reopen it.  
Also, make sure you are using the hosts file, when searching for hosts on most computers I’ve done this on, there’s usually more then one, I beleive the one you should be working on is the one in the widows folder (a few subfolders down though).

---

<div class="post-metadata">

**Author:** ![Dragwyr](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/dragwyr/32/2855_2.png) [@Dragwyr](https://boards.straightdope.com/u/Dragwyr)\
**Post date:** [March 10, 2008, 3:29am UTC](https://boards.straightdope.com/t/ie-ignores-hosts-file-other-ways-to-block-web-sites/440698/9 "2008-03-10T03:29:00Z")

</div>

Does the same thing happen in other browsers? If it does, then it is not an IE7 problem. I’d be curious to know if the same problem occurs in Firefox or Opera.

---

<div class="post-metadata">

**Author:** ![DudleyGarrett](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@DudleyGarrett](https://boards.straightdope.com/u/DudleyGarrett)\
**Post date:** [March 10, 2008, 4:57am UTC](https://boards.straightdope.com/t/ie-ignores-hosts-file-other-ways-to-block-web-sites/440698/10 "2008-03-10T04:57:29Z")

</div>

[QUOTE=Joey P]  
First of all, anything I put in the hosts file, I put in as (for yahoo) both [yahoo.com](http://yahoo.com) AND [www.yahoo.com](http://www.yahoo.com) as separate lines.  
Second, at this point, you’ve probably done this anyways, but if you save the hosts file while IE is open, you have to close all instances of it and reopen it.  
Also, make sure you are using the hosts file, when searching for hosts on most computers I’ve done this on, there’s usually more then one, I beleive the one you should be working on is the one in the widows folder (a few subfolders down though).  
[/QUOTE]

Yep - C:\windows\system32\drivers\etc\hosts
