We used to say that the internet has two faces one of good and that of bad. Knowing that websites are backbones of Internet, we may have to block some websites or web services for making a friendly and safer atmosphere among our family, friends, especially easily effective children or adolescents are there. Sometimes, you’ll have to block or unblock (both are interdependent) websites or web services in your office, college or any other places. We used to say a Good Network Administrator should be a good hacker as well because only then he could protect the network from malicious activity. The same fact is applicable for website blocking. You’ve to know how blocking is working and how to block a website in order to unblock a specific website URL or web service.
The base of all these things starts from getting familiar with Windows Host Files and understanding its various possibilities. Windows Hosts file are the head of your computer which helps it to find and connect to a corresponding URL (Domain Name) of an IP Address. When compared to DNS Servers as the DNS servers may be saying that Facebook.com is linked to 18.104.22.168 but you can change it through hosts file. Which means Windows Hosts files can be used for blocking websites and redirecting a specific URL to another one. So, let’s know the real use of Windows Hosts file in order to get more of your network features.
Edit your Windows Host File
As said before, making changes to your default networking settings includes a primary step of editing the Windows Hosts file of your PC. But it’ll be quite tedious to do it with notepad so it’s better to install advanced notepad softwares such as Notepad++ along with administrative privileges. For editing the file, first click ‘Start’, right click on the icon of Notepad++ or any other editor and select ‘Run as Administrator’.
After opening Notepad++ with administrative privileges, select option File à Open and head to the folder located at C:\Windows\System32\etc. Select Text files filter option from right-bottom of the window. Then open the file named hosts. You don’t have to reboot your PC to make changes as the Windows Host file updates itself when you hit the save button.
Block a Website URL
For blocking a specific website URL, you’ve to add the following text in the hosts file.
Through adding this phrase, you’re doing such a simple job. You’re saying your PC that the example.com URL is working based on the IP Address 127.0.0.1. So, when you try to navigate to example.com from your PC, DNS will be actually connecting to 127.0.0.1 at instance without searching for the real IP address of example.com. That’s why we said that Hosts file has more privileges than your DNS servers. By default, there will be no web servers on your computer and you’ll be seeing a failed message like following.
Redirecting a Website
As we said in the introduction, Windows Hosts file can be used for redirecting a specific website to another one. If you think someone of your family is using an unwanted website, you can redirect it to another URL by this. For example, we’re trying to redirect from Facebook.com to twitter.com. For doing this, you want to find the corresponding IP Address of twitter.com which can be got by using the in-built command prompt of Windows. Open Command Prompt and type the command ‘ping twitter.com’ and you’ll see a IP address. Then add the following section to host file
The command forces your PC to go to twitter.com when you type ‘Facebook.com’ on the address bar. So, you’ll get a simple but effective website redirection.