How to block websites using hosts file

File Hosts offers many handy options for dealing with network buttons that you can use the hosts file to block useless advertisements, annoying pop-up windows, banners ...

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.

Picture 1 of How to block websites using hosts file

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".

Picture 2 of How to block websites using hosts file

+ 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:

Picture 3 of How to block websites using hosts file

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:

Picture 4 of How to block websites using hosts file

Do the same you can block any website you want to block. Good luck.

Update 18 May 2020
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile