Another common usage of HOSTS file is to block websites including advertisements and web trackings by mapping it to a localhost which is 127.0.0.1 or to a non-routable 0.0.0.0 IP address. Other than using the HOSTS file for good purposes, some malware uses it to block the infected computers from accessing security based websites.

Just make sure to change the websitename with the name of the file which you want to block. 127.0.0.1 www.websitename.com. 127.0.0.1 websitename.com. For example if you want to block facebook, just put the code as shown below. STEP 6. Now, save the changes to the file. Now, copy and paste it back again in the etc folder. The original file will get replaced. Block Websites using Hosts File in Windows | Tutorials Dec 24, 2019 Block Twitter/Facebook in your /etc/hosts · GitHub

Because of this to effectively block the site, you must also block all hosts. This would usually mean: 127.0.0.1 facebook.com. 127.0.0.1 www.facebook.com" check the link for more details. Also i you trying to block multiple sites, its better to have a proper software like proxy server or firewalls which can block access to particular sites.

How Effective is Blocking Websites using HOSTS file Another common usage of HOSTS file is to block websites including advertisements and web trackings by mapping it to a localhost which is 127.0.0.1 or to a non-routable 0.0.0.0 IP address. Other than using the HOSTS file for good purposes, some malware uses it to block the infected computers from accessing security based websites.

How to Edit the Hosts File in Windows 10

Mar 22, 2016