Modifying your computer’s hosts file allows you to “trick” your computer into loading your domain name directly from our servers rather than where your domain may currently be pointed.
This is especially handy when you are creating a brand new site on a new server while you have another one live.
You will need to follow the steps below on how you can access and modify your hosts file on your local device and enter your server IP address [“Finding the nameservers and IP address for hosting in Help.com”] followed by your domain name at the bottom of the file.
Your entry will look like this with your domain and IP address replacing the information:
12.123.12.123 yourdomain.com www.yourdomain.com
You will need to ensure that you have both your domain and the www. subdomain are included.
Your hosts file will look like this once completed with some differences between operating systems:
Windows 8-11
- Press the Windows key.
- Type Notepad in the search field.
- In the search results, right-click Notepad and select Run as administrator.
- From Notepad, open the following file:
c:\Windows\System32\Drivers\etc\hosts - Make the changes to the file.
- Select File > Save to save your changes
Mac OSX
- On your computer, select Applications > Utilities > Terminal to open a Terminal window.
- Enter the following command in the Terminal window to open the hosts file
sudo nano /private/etc/hosts - Enter your password and press Enter on your keyboard
- A text editor will open within the Terminal window,
The file contains comments (lines that begin with the # symbol) and some default host name entries (for example, 127.0.0.1 – local host)
Under these comments are where you will need to input the hosts file entry listed above.
You will need to use the arrow keys in order to navigate this screen. - Once you have updated the file press CTRL + O on your keyboard and Enter to confirm and save the file.
- Press CTRL + X to close the file
Linux
- Open a Terminal window.
- Enter the following command to open the hosts file in a text editor:
sudo nano /etc/hosts - Enter your password and press Enter on your keyboard.
- Make the necessary changes to the file.
- Press Control-X.
- When you are asked if you want to save your changes, enter y.