maash Posted January 12, 2009 Share Posted January 12, 2009 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 Link to comment https://www.neowin.net/forum/topic/721364-cannot-block-website-usings-hosts-file-in-windows-7/ Share on other sites More sharing options...
ThreeLies Posted January 12, 2009 Share Posted January 12, 2009 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 Link to comment https://www.neowin.net/forum/topic/721364-cannot-block-website-usings-hosts-file-in-windows-7/#findComment-590411298 Share on other sites More sharing options...
maash Posted January 12, 2009 Author Share Posted January 12, 2009 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 Link to comment https://www.neowin.net/forum/topic/721364-cannot-block-website-usings-hosts-file-in-windows-7/#findComment-590411340 Share on other sites More sharing options...
Eric Veteran Posted January 12, 2009 Veteran Share Posted January 12, 2009 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 browserbut 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. Link to comment https://www.neowin.net/forum/topic/721364-cannot-block-website-usings-hosts-file-in-windows-7/#findComment-590412416 Share on other sites More sharing options...
kronckew Posted August 12, 2009 Share Posted August 12, 2009 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. Link to comment https://www.neowin.net/forum/topic/721364-cannot-block-website-usings-hosts-file-in-windows-7/#findComment-591423158 Share on other sites More sharing options...
Saint Shiv Posted August 13, 2009 Share Posted August 13, 2009 Make sure you disable DNS Client service via services.msc before you add any files to your host file, and as mentioned, flush your DNS cache afterwords. Using HostsXpert personally, works fine? Link to comment https://www.neowin.net/forum/topic/721364-cannot-block-website-usings-hosts-file-in-windows-7/#findComment-591427494 Share on other sites More sharing options...
nicolasavru Posted August 13, 2009 Share Posted August 13, 2009 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. Link to comment https://www.neowin.net/forum/topic/721364-cannot-block-website-usings-hosts-file-in-windows-7/#findComment-591430254 Share on other sites More sharing options...
ComputerGump Posted April 15, 2011 Share Posted April 15, 2011 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!!! Link to comment https://www.neowin.net/forum/topic/721364-cannot-block-website-usings-hosts-file-in-windows-7/#findComment-593893388 Share on other sites More sharing options...
+BudMan MVC Posted April 15, 2011 MVC Share Posted April 15, 2011 Nonsense - tab clearly still works.. Not sure what you were doing wrong, but tab is just fine. Link to comment https://www.neowin.net/forum/topic/721364-cannot-block-website-usings-hosts-file-in-windows-7/#findComment-593893528 Share on other sites More sharing options...
ComputerGump Posted April 15, 2011 Share Posted April 15, 2011 Nonsense - tab clearly still works.. Not sure what you were doing wrong, but tab is just fine. 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. Link to comment https://www.neowin.net/forum/topic/721364-cannot-block-website-usings-hosts-file-in-windows-7/#findComment-593894628 Share on other sites More sharing options...
Ulpian Posted April 15, 2011 Share Posted April 15, 2011 Are you using 64-bit version ? Link to comment https://www.neowin.net/forum/topic/721364-cannot-block-website-usings-hosts-file-in-windows-7/#findComment-593894654 Share on other sites More sharing options...
ComputerGump Posted April 15, 2011 Share Posted April 15, 2011 Are you using 64-bit version ? Yes I am. Are you using 64-bit version ? I take that back. This was on my VM machine which was running 32 bit. Link to comment https://www.neowin.net/forum/topic/721364-cannot-block-website-usings-hosts-file-in-windows-7/#findComment-593894672 Share on other sites More sharing options...
Blaze_Zewi Posted April 15, 2011 Share Posted April 15, 2011 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. Link to comment https://www.neowin.net/forum/topic/721364-cannot-block-website-usings-hosts-file-in-windows-7/#findComment-593894750 Share on other sites More sharing options...
Recommended Posts