Redirect and Block URLs you can easily on Windows. Just by adding the IP of a website, you can redirect or block it. Of course, this is very useful to limit the access of your employees or children from accessing websites that you do not allow.
Your Windows PC has hidden files inside Windows folders that you may never use. You the file named HOSTS you can find in the “%windir%/system32/drivers/etc” folder.
Other Interesting Articles
HOSTS file on Windows
You can find the file HOSTS in the Windows operating system in the folder “%windir%/system32/drivers/etc/hosts”. The HOSTS file serves as a repository of hostnames and addresses for local hosts and other hosts on the Internet network, using the Internet Protocol (IP).
This file serves as a DNS service for your local computer and replaces the mappings provided by DNS servers connected to your computer over the network.
If the DOMAIN protocol is being used by a local host, the computer is a member of the domain, the completion routine will first query the Domain’s DNS server before performing the lookup in this hosts file. In a local network without a Domain, the completion routine will scan this host file for information regarding the hostname and its corresponding address.
Edit the HOSTS File on Windows
You can use a simple text editor, such as Notepad or Notepad++, to open and modify Windows hosts files.
- Open Notepad and run it as administrator.
- If the UAC dialog box asks for permission, click the Yes button to allow.
- Then click “File > Open” on the Notepad window.
- In the “Open” dialog box, change the file type to “All files (*.*)”.
- Then navigate to the folder “C:\Windows\System32\drivers\etc” and select the “hosts” file.
- Click the Open button to open it.
Redirect Domain URLs using Windows Host File
You can use the hosts file to redirect the website the user is trying to visit. For example, if you don’t want users to use Facebook or YouTube, you can redirect www. facebook.com and yotube.com to your company’s website. If your company’s server IP address is 123. 123. 123. 123, on the last line of the hosts file, add a command like the following:
123. 123. 123. 123 www. facebook.com
123. 123. 123. 123 yotube.com
The line you add will cause someone to go to Facebook or YouTube if they go to Facebook or YouTube to be redirected to your company’s website.
Block Domain URLs using Windows Host File
In addition to being used to redirect URLs, you can also block URLs that you don’t allow to be accessed. This method is also quite effective to limit your child’s access to websites or online games that have a negative impact.
Providing incorrect IP address information will cause the URL to be inaccessible. To do this, IP 127.0.0.1 which is the local IP of your computer is often used. On the last line add:
127.0.0.1 www. facebook.com
127.0.0.1 www.roblox.com
This line will cause the URL of www.facebook.com and www.roblox.com to be inaccessible. If you try to open it through a browser, you’ll see an error message displayed.