The most common reason to edit the hosts file is to test a website before changing the 'live DNS' to complete a migration. To do this, you should add lines as shown below:
Replacing 'x.x.x.x' the IP address of your service with ourselves, and mydomain.com with the domain for which you wish to override the 'live DNS'.
Remember to remove these lines once you have completed the testing and migrated!
For Windows 8, 8.1, 10
- Open the start menu.
- Type or Search - "Notepad"
- Right click Notepad and select run as administrator.
- Within Notepad, Click File > Open
- For "File name:" enter: c:\windows\system32\drivers\etc\hosts
- Click Open
From here you can make changes to your hosts file at the administrator privilege level.
For Windows 7
- Press the Windows Key + R simultaneously.
- Enter: notepad c:\windows\system32\drivers\etc\hosts
- Click Ok (Please check it is running as administrator)
- Open a Terminal window.
- Type the following command: sudo vim /etc/hosts
- Press enter.