Support Centre

How to update your hosts file

Not enough ratingsNot enough ratingsNot enough ratingsNot enough ratingsNot enough ratings

Article

This article will demonstrate how you can update your Hosts file on both Windows and Mac to preview your site before making any DNS changes.

Changing the local hosts file on your computer is an extremely useful tool that will allow you to view your website hosted on a specific server address, without the need to update the DNS for the domain. This is particularly useful when migrating your site from one provider to another, as you will be able to view the new website on your computer, whilst everybody else will still see the old website.

windows 10

Firstly, you will need to open the application Notepad as an Administrator.

open notepad as an administrator

Next you will need to click File > Open.

notepad file and open

At the top of the window, search for C:\Windows\System32\drivers\etc and hit Enter on your keyboard.

search folder structure

Then change the displayed file types from Text Documents to All Files.

select all files

Click on the file called Hosts, and then click Open.

open hosts file

Underneath all of the text in the file, simply enter the IP address for your hosting followed by the name of your website.

Apache - Use 85.233.160.145
cPanel - Use your cPanel IP address
Windows - Use 81.88.60.34

We would recommend that you enter two separate lines for both your primary domain and your www subdomain, as shown below.

edit hosts file

Once you have applied the correct changes, click File and Save.

save hosts file


macOS logo

Within a new Finder window, click on Applications and then double click on the Utilities folder.

open utilities folder

Next, double click on Terminal.

open terminal

Within Terminal, enter the following command:

sudo nano /etc/hosts

and hit return on your keyboard.

enter command into terminal

You will then need to enter your Mac's Administrator Password, and hit return.

enter mac password

Underneath all of the text in the file, simply enter the IP address for your hosting followed by the name of your website.

Apache - Use 85.233.160.145
cPanel - Use your cPanel IP address
Windows - Use 81.88.60.34

We would recommend that you enter two separate lines for both your primary domain and your www subdomain, as shown below.

enter domain and IP address

In order to save the file, hold control and O on your keyboard.

Rate This Article

How useful was this article?

Not useful A little useful Useful Very useful Everything I needed