Steps:
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.
- Press the Windows key, type
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).
Edit the Hosts File:
- Add a new entry at the bottom of the file in the following format:
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.
[IP Address] [Domain Name]
- For example:
- 127.0.0.1 example.com
- 192.168.1.10 mytest.local
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.