January 20, 2025

How to add an entry to the Microsoft Windows hosts file

by , in
Just putting these here in my blog for my notes. :) 

Steps:

  1. Open Notepad as Administrator:

    • Press the Windows key, type Notepad, then right-click on Notepad and select Run as administrator.
    • You must have administrator privileges to edit the hosts file.
  2. Locate the Hosts File:

    • In Notepad, click File > Open.
    • Navigate to the directory:
      C:\Windows\System32\drivers\etc
    • In the File name field, type hosts (if you don't see it, change the file type to "All Files" in the bottom-right dropdown).
  3. Edit the Hosts File:

    • Add a new entry at the bottom of the file in the following format:

    •  [IP Address] [Domain Name] 
                
      For example: 
       127.0.0.1 example.com 
       192.168.1.10 mytest.local
  4. Save the Changes:

    • Press Ctrl + S or click File > Save.
    • If you encounter a permission error, double-check that Notepad was opened as an administrator.

Notes:

  • The hosts file allows you to manually map domain names to IP addresses, overriding DNS lookups.
  • Be careful when editing the file—incorrect entries can disrupt your network or internet access.


Microsoft Windows hosts file

Post Top Ad