Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

3 Answers 3

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.

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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