How do I edit my Hosts file? Print

  • DNS
  • 101

Hosts file

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:

x.x.x.x mydomain.com
x.x.x.x www.mydomain.com

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

  1. Open the start menu.
  2. Type or Search - "Notepad"
  3. Right click Notepad and select run as administrator.
  4. Within Notepad, Click File > Open
  5. For "File name:" enter: c:\windows\system32\drivers\etc\hosts
  6. Click Open

From here you can make changes to your hosts file at the administrator privilege level.

For Windows 7

  1. Press the Windows Key + R simultaneously.
  2. Enter: notepad c:\windows\system32\drivers\etc\hosts
  3. Click Ok (Please check it is running as administrator)

For Mac

  1. Open a Terminal window. 
  2. Type the following command: sudo vim /etc/hosts
  3. Press enter.

Was this answer helpful?

« Back