How to block websites using hosts file
Find out about hosts file
File hosts play an important role in computers. It is used to map based on hostname and domain name to corresponding IP addresses.
File Hosts offers many handy options for dealing with network buttons that you can use file hosts to block useless advertisements, distracting pop-up windows, banners, web pages. pornography, or even redirects to other websites that users don't want.
The following tutorial will guide you how to block websites with hosts file :
Step 1: Find the hosts file on the computer
You can open the hosts file in either of the following ways:
- Method 1:
+ For computers using the Windows operating system, you can find the hosts file by the following "C: WindowsSystem32driversetchosts".
+ For computers using Unix / Linux operating system: the hosts file is located at "/ Etc / hosts"
- Method 2:
Do a host file search by searching quickly on your computer by typing in the Search progarms section and find the following path ' C: WindowsSystem32driversetc ' as shown below:
Step 2:
You should save the hosts file to a safe place, in case we edit the hosts file, it may cause a system error. Once you've found the host file, open the hosts file with the file editing software included in the file. eg computer notepad and add parameters to edit the hosts file.
If you want to block a website, you just need to add the following command at the end of the hosts file in your computer:
127.0.0.1 xyz.com
Where xyz.com is the website you want to block and then save the file.
How the command line works is when you visit a website with the address xyz.com, your computer will be redirected to access your own computer. Because your computer does not have a web server, that connection will fail. Hence it can block websites you don't want.
For example, if I want to block dantri.com.vn, I can simply add the hosts file to the command line as shown below:
Do the same you can block any website you want to block. Good luck.
You should read it
- How to Block Websites on Google Chrome
- Simple and fast steps to edit Host File on Windows 10
- How to Block Websites on Firefox
- Does Viettel block websites that contain 18+ videos and images on computers and phones?
- Instructions on 2 ways to quickly block websites from opening automatically
- How to block websites on Chrome simple, effective
- How to block websites that open on Coc Coc 100% successfully
- How to Block and Unblock Internet Sites (On a Mac)
May be interested
- How to open the hosts file on Windows - The hosts file stores the device's IP informationthe host file on a windows computer will store information about the server and the domain name pointed to. we can edit the host file to block website access, or access to facebook,... so how to open the host file on the computer?
- Instructions to restore the hosts file on Windows to defaultdetailed instructions on how to restore the hosts file on windows to default, like when windows was installed. how to reset the hosts file on windows is the fastest and easiest way
- 6 simple ways to enable the right-click feature to block that sitewhile it is no longer popular, many websites still use javascript or html to disable their right-click feature.
- How to Edit the Hosts File on a Macediting your /etc/hosts file is useful for testing a new website. it allows you to point a domain name (such as www.mynewdomain.com) at a custom ip address on your local computer only. in this article, we will use the ip address 1.2.3.4 as...
- How to block websites on Firefoxto block websites on firefox, we will need to install a website blocking extension on your computer or install an app on your phone to block.
- How to Block Websites on Google Chromethis article shows how to block access to some websites on google chrome using a computer, phone or tablet. if you use a computer or android, you can use the free block site app to block websites. if you have an iphone or ipad, you'll block websites in your screen time settings, but this will affect the entire web browser on your phone or tablet, not chrome.
- How to edit the Host file, how to edit the Host file, read and open the Host filedepending on your needs and purposes, you need to edit the hosts file accordingly. you want to open the hosts files to edit or add the command line to the hosts file. but you still do not know how to open the hosts file on windows 7 like?
- Does Viettel block websites that contain 18+ videos and images on computers and phones?starting from november 13, 2019, viettel users have reflected on their inability to access websites containing videos and images 18+.
- Instructions on 2 ways to quickly block websites from opening automaticallyhave you ever encountered a situation where, while accessing chrome, strange websites automatically open continuously? this article will show you 2 simple ways to block websites.
- Block websites from opening automatically on Chrome browserwhile using the internet, there are many websites that automatically pop up with ads that are extremely annoying. so how to block these websites?