Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

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

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

    
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
up vote 7 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.

share|improve this answer

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

share|improve this answer

I think your hosts file may be being rolled back by the built-in Windows Defender.

Deactivate Defender then edit the hosts file, making sure to remove any read-only attribute.

share|improve this answer
2  
windows defender is a windows 8 thing. This question predates it by about 3 years. – Journeyman Geek Nov 12 '12 at 11:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .