Block or Redirect Websites Using the Windows Hosts File

By | January 6, 2019

The Windows Hosts file is used to control and map IP addresses. If you want to block or redirect specific websites then you need to edit the windows hosts files.

Steps to Block Websites Using Windows Hosts Files

Step 1: First, Open Windows Explorer. Now Click on This PC or My Computer.

Step 2: Open C:\, then click on the Windows folder. Next Open System32 folder, Inside that open the drivers folder and then open etc folder. Here you can see some files and open hosts files.

Step 3: Now, notice that the file type for the host’s file is listed as File. Now open notepad as Administrator. And drag hosts file on the notepad.

Windows Host Files

To add new entry in hosts file is very easy. The hosts file uses the format:

IP Address

Step 4: To block the website add IP Address for hosts that you want to block. So, if I wanted to block a website like, I could just add the following line in hosts file:

Steps to Redirect Websites Using Windows Hosts Files

If you didn’t want to block the website in that way, you could also redirect it to another website.

Step 1: First, you need to find the IP address of the other site. For example, I want to redirect from to And assume the address of is

Step 2: Add the new entry in windows hosts file like, Refer below sreenshortt,

Redirect Windows Host File

Nice! Now when I visit, I get redirect to If the website uses HTTPS like or something, it should still redirect if you use the host name because there is no way to specify the HTTPS version of a website in the HOSTS file. The hosts file is still useful, even in Windows 10. It also still works just fine in Windows 8, 7, Vista, etc.

Sponsored Links