# blocking URLs with the hosts file - not

**URL:** <https://boards.straightdope.com/t/blocking-urls-with-the-hosts-file-not/220295>\
**Category:** Factual Questions\
**Created:** [December 21, 2003, 9:13am UTC](https://boards.straightdope.com/t/blocking-urls-with-the-hosts-file-not/220295 "2003-12-21T09:13:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Apollon](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@Apollon](https://boards.straightdope.com/u/Apollon)\
**Post date:** [December 21, 2003, 9:13am UTC](https://boards.straightdope.com/t/blocking-urls-with-the-hosts-file-not/220295/1 "2003-12-21T09:13:06Z")

</div>

i’m trying to protect my computer from advertising and p\*rn sites by entering their URLs into the hosts file.  
usually it works, but some sites apparently are able to bypass this. even though their URL is correctly entered into the file, the site will load. am i doing something wrong?

---

<div class="post-metadata">

**Author:** ![Mops](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/mops/32/16494_2.png) [@Mops](https://boards.straightdope.com/u/Mops)\
**Post date:** [December 21, 2003, 10:35am UTC](https://boards.straightdope.com/t/blocking-urls-with-the-hosts-file-not/220295/2 "2003-12-21T10:35:48Z")

</div>

What you need to enter into the hosts file is not the URL but the domain, including all subdomains (e.g. [ads.example.com](http://ads.example.com) for an ad url of [http://ads.example.com/jjhgsjgjhgcjsjha,098987,878.jpg](http://ads.example.com/jjhgsjgjhgcjsjha,098987,878.jpg) ).

---

<div class="post-metadata">

**Author:** ![Apollon](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@Apollon](https://boards.straightdope.com/u/Apollon)\
**Post date:** [December 21, 2003, 10:38am UTC](https://boards.straightdope.com/t/blocking-urls-with-the-hosts-file-not/220295/3 "2003-12-21T10:38:10Z")

</div>

ah, nevermind… already found the answer:  
“Entries are invalid if they contain “http:” or an ending “” slash.”

disregard please 🙂
