Windows

Edit hosts file in Windows

Edit hosts file in Windows

Editing the hosts file for web hosting is not that easy. The file is easy to find, but you need the appropriate rights to make changes.

Webhosting: How to get the rights to edit the hosts file

The hosts file ensures that each IP address is assigned a host name. This hosts file can be found in the depths of the Windows files. You can edit the hosts file using a text editor.

  • In Windows Explorer, type “%windir%\system32\drivers\etc”.
  • Next, right-click on the “hosts” file.
  • Now go to “Open with” and select the editor.
  • The editor opens and you can now edit the file.

Edit the hosts file using the editor under Windows

Once you have opened the editor as an administrator, you can get down to business: editing the hosts file.

  • Press and hold the Ctrl key and “O” within the editor. Alternatively, you can go to “File” and then “Open…”.
  • In the newly opened window, navigate to C:\Windows\System32\drivers\etc. Make sure that “All files (*.*)” and not “Text files (*.txt)” is selected at the bottom right so that the hosts file is also displayed.
  • In the “etc” folder you will find the “hosts” file. Once you have opened the hosts file, you will see some English comments preceded by the # symbol at the beginning of the line. You can also use the hash symbol to write your own comments and notes that are only for your information.
  • If you now want to add a new entry, it is best to do this below the comments. Each entry should be on a separate line. At the beginning of the line, write the IP address and after it, separated by at least one space, the associated host name.
  • If you want to block all network traffic to a specific domain using the hosts file, use “127.0.0.1” as the IP address. For example, if you enter the line “127.0.0.1 google.com”, access to google.com will be blocked. This means that you will no longer be able to access the site in your browser, for example.
  • Once you have edited the hosts file as desired, press and hold the Ctrl key and “S” on the keyboard in the editor window to save the modified Windows file.
About author

As a tech enthusiast and writer for votoh.com, I focus on providing practical solutions for common issues related to iOS, Android, Windows, macOS, Office, Smart TVs, software, games, and hardware. With a passion for simplifying technology, I aim to make complex topics accessible to everyone, offering tips and troubleshooting advice to help users navigate the digital world with ease.