The hosts file in Windows 10 dedicated servers is a plain text file used to map hostnames to IP addresses, allowing you to override DNS for specific domains. This is particularly useful for web development, testing, blocking websites, or redirecting domains locally.
Here’s a step-by-step guide on how to safely edit the hosts file on a Windows 10 machine.
The hosts file is located at:
Each entry in this file maps an IP address to a domain name, e.g.:
This forces the system to resolve example.com to the IP address 127.0.0.1 (localhost) instead of querying DNS servers.
You must run a text editor with administrative privileges to edit the hosts file.
Press Start, type notepad
.
Right-click Notepad, choose Run as administrator.
If prompted by UAC (User Account Control), click Yes.
In Notepad:
Click File > Open.
Navigate to:
Change file type from “Text Documents (*.txt)” to “All Files“.
Select hosts and click Open.
Now, you can add or remove lines. Format:
Examples:
Redirect domain to local machine:
Point domain to a specific server:
To block a website:
⚠️ Each entry must be on a new line, and lines starting with
#
are treated as comments.
After editing:
Click File > Save.
Close Notepad.
The changes take effect immediately — no reboot required.
Open Command Prompt and type:
It should show the IP you specified.
You can also test in the browser, or use ipconfig /flushdns to clear DNS cache if changes don’t reflect immediately.
Access Denied? Make sure you opened Notepad as an administrator.
Still seeing old IP? Run ipconfig /flushdns in the Command Prompt.
Antivirus conflict? Some security software may block changes to the hosts file — whitelist it if needed.
Preview websites before DNS propagation
Block distracting or malicious sites
Set up development or staging environments
Override DNS without modifying server settings