If you need to check, test or access a new website that is only accessible on a temporary URL, you may need to edit the hosts file to properly test the website. This method of access can also be used to make changes to a staging website prior to the website going live, or to simply verify the outcome of a migration.

It is commonly required to use the hosts file when working with Content Management Systems such as WordPress or Joomla that are installed to respond to the domain name instead of the IP address.

The hosts file itself need to be updated with specific syntax, this will be in the format of ‘ip domain(s)’, for example. mywebsite.com www.mywebsite.com

Once this is set you can access the website on the new server using its normal domain name/URL. The location of the hosts file and how to edit this depends on the operating system you are using.

Below are guides for WindowsMac and Linux.


  1. Locate ‘notepad‘ in the start menu
  2. Right click on notepad and select ‘Run as Administrator
  3. Click ‘File‘ and then ‘Open
  4. Navigate to the following location ‘C:\Windows\System32\drivers\etc
  5. Change ‘Text Documents (*.txt)‘ to ‘All Files
  6. Select ‘hosts‘ and click ‘Open
  7. Type in the details as required
  8. When done save the file by clicking on ‘File‘ and then ‘Save


  1. Open Finder
  2. Select ‘Applications‘, and then ‘UtilitiesYou can also hold down the ‘Control‘ and ‘Shift‘ keys and press ‘U
  3. Open ‘terminal
  4. Type in ‘sudo nano /private/etc/hosts
    (If this file is blank use ‘sudo nano /etc/hosts‘)
  5. Type in your computer’s password and press ‘Enter
    The screen will remain blank while doing this
  6. Use the ‘down arrow‘ key to navigate to the end of the file
  7. Type in the details as required
  8. Hold down the ‘Control‘ key and press ‘O‘ to save, then press ‘Enter
  9. Hold down the ‘Control‘ key and press ‘X‘ to exit nano
  10. You can now exit terminal