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.
  • Posts

    • WYSIWYG Web Builder 20.2.1 by Razvan Serea Web Buialder is a WYSIWYG (What-You-See-Is-What-You-Get) program used to create complete web sites. WYSIWYG means that the finished page will display exactly the way it was designed. The program generates HTML (HyperText Markup Language) tags while you point and click on desired functions; you can create a web page without learning HTML. Just drag and drop objects to the page position them "anywhere" you want and when youre finished publish it to your web server (using the build in Publish tool). Web Builder gives you full control over the content and layout of your web pages. One Web Builder project file can hold multiple web pages. Desktop publishing for the web, build web sites as easy as Drag & Drop "One Click Publishing" No FTP program needed. No special hosting required, use with any Hosting Service! Easily create forms using the built-in Form Wizard plus Form validation tools and built-in CAPTCHA. Advanced graphics tools like shapes, textart, rotation, shadows and many other image effects. Fully integrated jQuery UI (Accordion, Tabs etc), animations, effects and built-in ThemeRoller theme editor. Google compatible sitemap generator / PayPal eCommerce Tools Many navigation tools available: Navigation bars, tab menus, dropdown menus, sitetree, slidemenus. Built-in Slide Shows, Photo Galleries, Rollover images, Banners etc. Support for YouTube, Flash Video, Windows Media Player and many other video formats. Unique extension (add-on) system with already more than 250 extensions available! Create HTML5 / CSS3 websites today HTML5 document type (optimized HTML5 output). HTML5 audio/video and YouTube HTML5 support. HTML5 forms: native form validation, new input types and options, web storage. HTML5 canvas and svg support in shapes and other drawing tools. CSS3 @font-face. Use non web safe fonts in all modern browsers. CSS3 opacity, border radius, box shadow. CSS3 gradients. Add cool gradient effects using native CSS3 (no images). CSS3 navigation menu. Create awesome menus without using JavaScript or images. CSS3 animations and transitions. Including support for 2D and 3D transforms! Features for advanced users: Login Tools/Page Password Protection. Built-in Content Management System with many plug-ins (guestbook, faq, downloads, photo album etc). Add custom HTML code with the HTML tools. JavaScript Events: Show/hide objects (with animation), timers, move objects, change styles etc. Layers: Sticky layer, Docking layer, Floating layer, Modal layer, Anchored layer, Strechable layer and more! jQuery Theme Manager, create your own themes for the built-in jQuery UI widgets. Style Manager (global styling, H1, H2, H3 etc). Master Frames and Master Objects: reuse common element in your website. and much more! WYSIWYG Web Builder 20.2.1 changelog: Improved: Images in the properties of Photo Gallery, Photo Grid, Photo Collage and Slide Show can now be re-arrange using drag & drop. Improved: Default aspect ratio of HTML5 audio Fixed: Issue with list item icon offset in workspace. Fixed: 'Edit' button text in Login Admin cannot be changed. Fixed: Issue with Card max-width size calculation in breakpoints Fixed: Issue with (fixed) Layout Grid column height in breakpoints. Download: WYSIWYG Web Builder 64-bit | 30.1 MB (Shareware) Download: WYSIWYG Web Builder 32-bit | 28.0 MB Screenshot: >> Click here << Link: Home Page | Templates | Free extras/addons | Changelog Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Damn no doubt this is gonna be good, can't think of many franchises as consistent as RE (apart from 3 remake)
    • There are two version of qbittorrent 5.1.0 The normal version which I think is based of QT5 & the QT6 lt20 version. I'm currently using the QT6 LT20 version of 5.1.0 and it downloaded an ubuntu iso perfectly fine.
    • Are we forgetting the hardware degradation on 13th and 14th gen??
    • Cry more. The Ukrainians who had internet access because of Starlink were trash too, huh?
  • Recent Achievements

    • One Year In
      Vladimir Migunov earned a badge
      One Year In
    • One Month Later
      daelos earned a badge
      One Month Later
    • Week One Done
      daelos earned a badge
      Week One Done
    • Mentor
      Karlston went up a rank
      Mentor
    • One Month Later
      EdwardFranciscoVilla earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      494
    2. 2
      snowy owl
      252
    3. 3
      +FloatingFatMan
      250
    4. 4
      ATLien_0
      225
    5. 5
      +Edouard
      181
  • Tell a friend

    Love Neowin? Tell a friend!