How to update HOST file on your OS to view domain without modifying the live nameservers

  Print
Modifying your local OS host file is useful for times when you need to test the development site before putting it live.

For Windows:
  1. Type notepad in your Start search. Right click on it and click on Run as Administrator
  2. Now in notepad, File -> Open -> c:\windows\system32\drivers\etc\hosts
  3. You should now see the host file in your notepad. For example, if your domain is domain.com and the server ip is 1.2.3.4. Then you would add the following into the host file. You can find the IP of your domain by logging into cPanel.
1.2.3.4 domain.com

Save the host file and now when you goto domain.com in your browser, it should goto the 1.2.3.4 server.

You can verify the changes are updated by issuing a ping command in Command Prompt to see if the domain is now resolving to the 1.2.3.4 IP address.

ping domain.com


For Mac:
  1. Open Terminal
  2. Type in the following in the terminal
sudo nano /etc/hosts/

3. Scroll to the bottom of the file. if your domain is domain.com and the server ip is 1.2.3.4. Then you would add the following into the host file. You can find the IP of your domain by logging into cPanel.

1.2.3.4 domain.com

4. Now hit CTRL + X then when asked if you want to overwrite, Y then enter to save the file

You can verify the changes are updated by issuing a ping command in Terminal to see if the domain is now resolving to the 1.2.3.4 IP address.

ping domain.com

0 out of 0 people found this article useful.

Related Articles

Login

 
Forgot password?
Register now