My host file is not working on Windows 10

hosts-file

This is crazy, I've never has this issue until now…I like to use the hosts file to block certain websites. But for some reason my hosts file is not blocking any website. I went over this post (Hosts File not working correctly) and tried most if not all of those things but I'm still not able to use my hosts file to block websites. Anything else I can do to fix this? I've used hosts files for years and never had this issue.

Note: I just got this PC (refurbished) so maybe they created some weird settings before shipping it? I wouldn't think so but figured I'd mention it.

Here is how I have my hosts file entries…maybe I"m missing something?

127.0.0.1 localhost
127.0.0.1 website.com
127.0.0.1 www.website.com
127.0.0.1 website2.com
127.0.0.1 www.website2.com

Best Answer

Just changing the hosts file is not enough. You also need to flush your DNS cache.

Open a command prompt and type:

ipconfig /flushdns

Now, test if it works by pinging one of the domains, preferably one you changed recently:

ping www.website2.com

and see if it returns the 127.0.0.1

If the ping does not work, then it is likely that the permissions on the hostfile are incorrect. Incorrect permissions on the hostfile may cause an arbitrary lock on the hostsfile which prevents windows from properly read it and populating the dns cache. Fix the permissions on the hostfile then perform an ipconfig /flushdns once more.

If the ping works, but the website does not load correctly, then the website is still loading from cache. Clear your browsercache to fix the issue.

Related Question