I modified hosts file to block google.com and its subdomains but it blocks only the main domain name. It does not block the subdomains. Windows 7 Starter

127.0.0.1 google.com

It blocks google.com but dows not block www.google.com

Then I tried this one: 127.0.0.1 *google.com It didn't helped.

link|improve this question

80% accept rate
Why would you want to block Google? – wallyk Dec 19 '09 at 17:14
It is just an example domain. I do not want to show the real domain here. – Anonymous Dec 19 '09 at 17:17
Why the downvote? I'm guessing it was before the migration, but just in case, it's a perfectly valid question. – Maxim Zaslavsky Dec 19 '09 at 20:14
Maybe edit this to read example.com to stop the freak-out comments? – Clayton Hughes Jul 13 '10 at 5:21
feedback

migrated from stackoverflow.com Dec 19 '09 at 18:45

This question came from our site for professional and enthusiast programmers.

2 Answers

up vote 6 down vote accepted

The hosts file is very basic, and by basic i mean BASIC. You are going to have to do

127.0.0.1 google.com
127.0.0.1 www.google.com
127.0.0.1 wave.google.com
127.0.0.1 docs.google.com

etc

If you are trying to pull a prank, use that, if you want to get serious, you need to invest in a network firewall or some such that will allow you to block domain names.

link|improve this answer
feedback

The hosts file doesn't support wildcards. You will need an ad blocking proxy / DNS program to do that. See e.g. TreeWalk DNS

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.