In this post, we will guide you on modifying or editing the Hosts file of Windows 10/8/7. Before proceeding with the steps, let me clear a few points related to the Hosts file in Windows operating system.
What is a Hosts File?
The Hosts file is a plain text file that maps servers or hostnames to IP addresses. It is the method to resolve hostnames to a specific IP address. The Hosts file is usually the first process in the domain name resolution procedure. It is located in the Windows folder: C:\Windows\System32\Drivers\etc. Here is an example for the Hosts file entry:-
220.127.116.11 gearupwindows.com #gearupwindows
The first section is the IP address where a request will be redirected to. The second section designates the location that we want to redirect a request from. The third section specifies a comment for the entry, starts with #. Each entry is usually separated by a space or a tab.
Why a Hosts File is Useful?
Imagine you have just completed a migration to a new server. To see how your domain will look and operate on a new server before moving to DNS settings, modify the Hosts file and add a new entry to your new server.
You can simply modify the Hosts file to point the domain to the new server’s IP. If our domain is gearupwindows.com and the old IP is 18.104.22.168, and the new IP is 22.214.171.124, you can temporarily comment out the current gearupwindows.com entry (using a ‘#’ symbol) and add an alternate entry that points to the new server IP.
126.96.36.199 gearupwindows.com #old
188.8.131.52 gearupwindows.com #new
If we add the above entry to our Hosts file, every time we open gearupwindows.com in our browser, we will be redirected to the 184.108.40.206 IP.
How to modify/edit Hosts File in Windows 10/8/7?
The Hosts file can be edited with any text editor. But when you try to save this file, you will get an error, “Access is denied.” By default, the Hosts file is protected from user changes. Before editing, you need to take ownership of the Hosts file to have full permissions to it. To get full access to the Hosts file, perform the following steps:-
1. Download and install the freeware tool TakeOwnershipPro on your computer.
2. Once TakeOwnerShipPro installed on your PC, open the folder
How to block a particular website using the Hosts file?
The Hosts file is handy and can block access to any websites you don’t want to visit. For example, suppose we don’t want to browse youtube.com anymore on our computer. We add the following line to the end of the Hosts file:
Now save the Hosts file and restart your computer to apply the changes. Now any users of your computer can not browse youtube on your PC.