How to Preview Your Website with the Hosts File Edit

Editing your Hosts file is the best way to preview a website you're building while the domain is hosted somewhere esle. It works by overriding the domain's A record from the view of your computer so your computer thinks the domain is live on our servers.

Your hosts entry will consist of the IP address of the server, and the domain name you wish to point it to.

For example:

101.0.112.154 yourdomain.net.au www.yourdomain.net.au

You can find your server IP in the email we sent you which contains your cPanel or WHM login details.

How to Edit the Hosts File in Windows

Step 1 - Click Start, Type in Notepad then right click and hit Run as Administrator. Click Continue on the 'Windows needs your permission' window.

d5042685d3e0964453b710fc6e5543cdd3287564?t=e7bfb1044e6bf3306a3b0cfe50b066bf


Step 2 - In Notepad, click File > Open, go to the C:\Windows\System32\Drivers\etc\ folder, click the box above Cancel and select All Files then click the hosts file and click Open

1b4f1c297f0b93a23d74af96fb262c8228650d2f?t=2f1da035d43195d3bd4e1f7c8cb3ddf6


Step 3 - Start a new line at the bottom of the file and enter the new entry, ie

101.0.112.154 yourdomain.net.au www.yourdomain.net.au

7b488954597fdaeca9bf52bcdc7e56585192ed61?t=b8103db9ad6b37ddc07bb1ce1f94db52


Step 4
- Save the file by going to File > Save in Notepad.

Note: You can disable this by adding a # to the start of the line you added.



How to Edit the Hosts File in Mac

Step 1 - Open the Terminal program (under Applications > Utilities)

Step 2 - Type in the following code: sudo nano /private/etc/hosts

Then type your password in if asked




Step 3 - Start a new line at the bottom of the file, and add the hosts entry, for example:

101.0.112.154 yourdomain.net.au www.yourdomain.net.au




Step 4 - When finished, hit Control+O followed by ENTER/RETURN to save changes, then hit Control+X to exit out of editing the hosts file.

Step 5 - Type in this command and hit ENTER/RETURN: dscacheutil -flushcache

Step 6 - Close the terminal

Note: You can disable this by going back into nano and adding a # to the start of the line you added.