To edit hosts file in Windows 10, you need to run Notepad as Administrator. To do that, using your windows search icon in the taskbar in windows 10, in windows 7, click start / and type in search box: notepad. In windows 8 and windows 8.1, at the metro screen, enter notepad in search box (up top right conner).
a notepad.exe will show up, right click on that notepad.exe icon and choose Run as Administrator. It will ask you to accept permission, click yes to accept.
A new Untitled Notepad window will open, click File/ Open. Navigate in Lookup to C:\Windows\System32\drivers\etc (All windows) if your windir is locate other than C, then change it depend yours. Make sure you show All files in below picture.
Click into hosts file and Open.
A host file window will open, change it as you want (in my case, i have change my domain bienthuy.com to host at new host IP is 184.108.40.206)
After you’ve done editing, click File/ Save.
Close that Notepad Window, Clear DNS cache by open Command Prompt as Administrator, then run command: ipconfig /flushdns
(Some time, after clear DNS cache, you have to restart your computer to take effect)
Open your web browser and go to the domain you change (mine is bienthuy.com) to see if it showing new host content or not.
Download windows host file example:
# Copyright (c) 1993-2019 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # For example: # # 220.127.116.11 rhino.acme.com # source server # 18.104.22.168 x.acme.com # x client host # localhost name resolution is handled within DNS itself. https://bienthuy.com # 127.0.0.1 localhost # ::1 localhost 127.0.0.1 localhost ::1 localhost 127.0.0.1 example.dev 127.0.0.1 www.example.dev