Cannot block website usings Hosts file in Windows 7


Recommended Posts

in Windows XP and Vista, you can go into your c:\windows\system32\drivers\etc\ directory and add websites in the Hosts file to block them from being accessed by any windows browser. But in Windows 7 it still opens the websites despite me adding them to the Hosts file.

is there a different way website blocking works in Windows 7?

Thanks

Try to see if it directly is ignoring the hosts file or just something with the browser.

1. Change a site in the hosts file and redirect it to '127.0.0.1'

2. Open Command prompt and try these commands 'ipconfig /flushdns' and then 'ping <website you blocked>'

If all is correct it should return 127.0.0.1

  ThreeLies said:
Try to see if it directly is ignoring the hosts file or just something with the browser.

1. Change a site in the hosts file and redirect it to '127.0.0.1'

2. Open Command prompt and try these commands 'ipconfig /flushdns' and then 'ping <website you blocked>'

If all is correct it should return 127.0.0.1

thats the thing, for example if i added www.website.com into the hosts file and ping it. it times out. but even after i close the browser and come back , it still goes to www.website.com in the browser

but yes, it seems to be ignoring the Hosts file

  maash said:
thats the thing, for example if i added www.website.com into the hosts file and ping it. it times out. but even after i close the browser and come back , it still goes to www.website.com in the browser

but yes, it seems to be ignoring the Hosts file

Did you try clearing your browser's cache?

Also, if I recall, the hosts file does not support wildcards, so a list like this:

www.blockdesite.com
forums.blockedsite.com
www1.blockdesite.com
www.blockedsite.org

must have a separate entry.

  • 6 months later...

i also find the hosts file is not working in win7 rtm, i have 'shortcut' in there

192.168.2.1 router

to allow me to just type router in the address bar to connect to my router admin page. works fine in xpsp3. does not work in win7.

added a few real addresses to speed up dns lookups, they also were not recognised. i tried adding them to the similar lmhosts file. that worked. it appears win7 is indeed ignoring the hosts file.

lmhosts (no extension) lives in the same dir. as hosts. slightly different syntax allows directives, see lmhosts.sam.

it indicates lmhosts is parsed only AFTER dynamic lookups fail. wonder if hosts behavior has similarly been changed.

i'd prefer it to work the old way as in all pre-win7 microsoft os's all the way back.

See if making the edit to hosts and then rebooting makes any difference. While experimenting with the DNS settings for my domain, I had to reboot before certain changes were 'seen' by Windows 7. Cleared DNS cache and browser cache, even tried a different browser, no change until I rebooted.

  • 1 year later...

I have been banging my head for hours on this and I think I have found the answer. For whatever reason Microsoft has decided that a tab in between your ip and hostname in the host file will not work in Windows 7. Try taking out the tab and using a space instead. Microsoft sucks!!!

  On 15/04/2011 at 15:59, BudMan said:

Nonsense - tab clearly still works.. Not sure what you were doing wrong, but tab is just fine.

post-14624-0-51925700-1302883141.jpg

If I take the tab out it works if it is in it doesn't. Not nonsense. If you are having problems I suggest you try it. It takes 2 seconds and if it doesn't work you are out 2 seconds.

This is not the best way to block a website. Any person over 13 with half a brain can bypass this method.

Unless you manage to block all search engine like Google, Yahoo, Bing etc. This method is only useful for folks that are not computer illiterate.

All right enough of my of topic nonsense...

Like other have said. After making change to the host file. Clear your DNS and restart and see if it works.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Popular Now

  • Posts

    • considering that took 4 years "to fix" ryzen performance on windows 11. look at the amount of time that AMD user have a degraded performance compared to intel on microsoft latest and greatest OS
    • MosaLingua Language Learning lifetime subscription price dropped by 97% by Steven Parker Today's highlighted deal lets you save 97% off lifetime access to a MosaLingua Language Learning Fluency Bundle. Buying link below. Description: Learning new languages doesn't have to be difficult or exhausting. In fact, you can learn and speak a foreign language at your own pace. MosaLingua is an all-in-one platform for learning the most useful words and expressions in the language of your choice, practicing language immersion, and improving your language skills with numerous different resources. Pick up the skills you need to use the language in any situation and store up to 6,000 keywords and expressions in your long-term memory, and choose content depending on your needs and your level. MosaLingua is a personalized language learning tool that adjusts to your level and your schedule, letting you make quick progress and avoid time-wasters. Access to 11 Full Language Courses: English, Spanish, French, Italian, German, Portuguese, Russian, Chinese, Japanese, Korean, and Arabic—plus any new languages we add in the future, at no extra cost. Science-Based Learning Method: Spaced repetition, neuroscience, cognitive psychology, and the 80/20 rule combine to help you retain vocabulary & speak faster. All-in-One Learning App: Practice listening, speaking, reading, and writing in one place with dialogues, flashcards, videos, audiobooks, grammar lessons & hands-on exercises. AI-Powered Coaching & Tools: Practice with MosaChat-AI, your 24/7 virtual tutor that helps you improve your writing and speaking skills with personalized feedback. Learn from the Content You Love: Thanks to MosaDiscovery, you can turn any online content into a learning opportunity. Learn languages by watching YouTube videos, Netflix series, reading articles, or exploring any website—with instant translations, personalized flashcards, and real-world vocabulary. Offline Mode & Cross-Platform Sync: Learn on your terms—anywhere, anytime. Use the app on iOS, Android, or the web. Built for Busy People Who Want Quick Results: Make real progress with just 10 minutes per day. Short, targeted sessions fit into any schedule. Good to know Length of access: lifetime Redemption deadline: redeem your code within 30 days of purchase Access options: desktop or mobile Max number of device(s): 1 Only available to NEW users Version: latest Updates included Lifetime access to MosaLingua Language Learning normally costs $4,850, but you can pick it up for just $97.99 for a limited time that's a saving of $4,702 off. For a full description, specs, and info, click the link below. Mosalingua: Lifetime Subscription now just $97.99 (was $4,850) Although priced in U.S. dollars, this deal is available for digital purchase worldwide. We post these because we earn commission on each sale so as not to rely solely on advertising, which many of our readers block. It all helps toward paying staff reporters, servers and hosting costs. Other ways to support Neowin Whitelist Neowin by not blocking our ads Create a free member account to see fewer ads Make a donation to support our day to day running costs Subscribe to Neowin - for $14 a year, or $28 a year for an ad-free experience Disclosure: Neowin benefits from revenue of each sale made through our branded deals site powered by StackCommerce.
    • you know what, looking at it again. you're right, i'm wrong. there are no curves. it's just straight lines. it's flat.
  • Recent Achievements

    • One Month Later
      EdwardFranciscoVilla earned a badge
      One Month Later
    • One Month Later
      MoyaM earned a badge
      One Month Later
    • One Month Later
      qology earned a badge
      One Month Later
    • One Year In
      Frinco90 earned a badge
      One Year In
    • Apprentice
      Frinco90 went up a rank
      Apprentice
  • Popular Contributors

    1. 1
      +primortal
      449
    2. 2
      +FloatingFatMan
      249
    3. 3
      snowy owl
      239
    4. 4
      ATLien_0
      196
    5. 5
      Xenon
      141
  • Tell a friend

    Love Neowin? Tell a friend!