On Windows 10
1) First, navigate to C:\Windows\System32\drivers\etc.
2) Right-click on hosts > Edit with preferred file editor (Run as Administrator). You can use Notepad
3) Enter the domain following the server IP address
eg:
8.8.8.8 MyDomain.com www.MyDomain.com
4) Finally, save the file.