HomeHow ToHow to Edit the Hosts File On Windows 10

How to Edit the Hosts File On Windows 10

Author

Date

RECOMMENDED: Download this tool to help you safely fix common Windows errors & automatically optimize system performance

To solve a specific problem or to block a particular website on a Windows 10 computer, sometimes, you may need to modify the Hosts file.

If you change the Hosts file, you can overwrite the Domain Name System (DNS) for a domain on a specific computer. DNS management is useful if you want to test your site without a test connection before using SSL, to check if the site works with aliases before changing DNS and for other DNS related reasons.

What is the Purpose of the Hosts File?

The purpose of the hosts file was initially what the DNS servers now do – to map friendly domain names to not-so user-friendly IP addresses.

Truth be told, it is much more easy to remember a domain name like Facebook.com than the IP address 172.217.1.238. Instead of entering an IP address into the address bar every time you want to browse through what’s happening on Facebook, you can simply enter a domain name and the DNS server that uses your device will assign the correct address, allowing you to easily visit the site.

The hosts file, which serves as a kind of DNS server, works in a similar way. To resolve a domain name, you can enter an IP address. In other words, you can ask your computer to download a different IP address than the DNS server so that you can do something interesting.

Where is the Location of the Windows Host File?

You should know where to find the hosts file before you can open it for editing. This is the location of the Hosts file under Windows 10 in Windows XP:

C:\Windows\system32\drivers\etc

How to Edit the Hosts File as an Administrator in Windows 10

The hosts file is usually stored in a plain text file in the Windows system folder and can be configured for various uses. A special reason why users edit the host file is to block some websites. This was probably one of the best and easiest ways to prevent unauthorized websites such as for instance, Facebook or YouTube, from being accessed – if that’s what you intended it to be.

Editing a Windows Hosts file does not necessarily mean going into a rabbit hole. In Windows XP and earlier versions, the process was quite simple, just add an exception to your antivirus, open it in Notepad, make changes, and save them.

If you try to edit your Hosts file under Windows 10, you will probably be able to open it quite well, but if you save it, you will get an error message:

“You don’t have permission to save in this location. Contact the administrator to obtain permission.”

This guide will allow you to edit the Hosts file without getting that error message.

  1. Click the Windows button and enter Notepad in the search box.
  2. Right-click Notepad, and then click Run as administrator.
  3. You will be asked: “Do you want this application to make changes to your device?
  4. Select Yes.
  5. In Notepad, select File, then Open.
  6. Go to C:\Windows\System32\drivers\etc\hosts or click on the address bar above, insert it and select Enter. If you do not see the host file directly in /etc, select All Files from the File Name: drop-down list, and then click on the Hosts file.
  7. Add the appropriate IP address and hostname to the end of the hostname, select Save, and then close the file.
  8. Finally, you need to clear the DNS cache so that your computer can recognize the changes made to the file. Click the Windows button and select a search for command prompt.
  9. Right-click Notepad, and then select Run as administrator.
  10. You will be asked: “Do you want this app to make changes to your device?
  11. Select Yes.
  12. Enter the following command in the terminal and press Enter:
ipconfig /flushdns

Once these steps are completed, you can test the changes by opening the command prompt and using the ping command (e.g., ping google.com) to make sure that the host is reached.

If you want to prevent your computer from accessing certain websites, you can use the feedback address (127.0.0.1) and then the domain name (e.g. 127.0.0.1 website.com), but it is better to use the built-in Windows firewall or third-party security software for this purpose.

How to Prevent Hosts File From Being Hijacked

Another thing you need to know about the hosts file is that it is infected with malware. The Hosts file causes viruses that damage your system and redirect it to another malware-infected website. Therefore, when you try to clean your computer, it is always useful to check the hosts.txt file.

When you enter a URL in your browser’s address bar, you are prompted for DNS to try to resolve the domain name to an IP address. However, the host file can be used to bypass this process by checking the host file before the DNS query. Hijack.host malware is a suspicious program that is identified by a number of security databases as a potential computer virus in a family of adware. Adware is a type of malware that can be easily detected by the numerous unwanted ads or ads to which affected users are exposed. If you want to prevent the hijacking of a host file, you must “lock” it.

  • Return to “C:\Windows\System32\drivers\etc\hosts”, right-click on the Hosts file and select “Properties” from the drop-down menu.
  • In the Host Properties window, select the Read Only check box and click Apply to save the changes.

Conclusion

It’s about editing a Hosts file. Although you probably won’t be using it outside the development environment or network, there are practical applications that can be useful to any PC user. You should also be aware that the host file also exists on Mac and Linux systems with the same syntax, but elsewhere.

STILL HAVING ISSUES? Try this tool to troubleshoot Windows errors and safely optimize system performance

Related

More From

How to Install Free VPN on Firestick

Firestick is a full-pack digital gadget that offers both free and paid channels. This piece of streaming device is designed to work with standard...

How to Prevent or Disable Use of USB Storage Devices in Windows 10

It is easy to transfer files from one computer to another using USB flash drive devices. However, you may not be sure if it...

How to Use Samsung Galaxy SmartTag Plus Tracker: Includes Price & Availability

Losing something is a waste of time and energy. If you misplaced a thing at home or in the office, it would take a...

How to Enable/Disable Snap Windows to Maximize Feature in Windows 10

Maximizing your computer screen is helpful if you are multitasking and you need to open several applications at one time. For instance, you have...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Recent Articles

Stay Connected

Trending