View your site on our server before DNS has been changed (using local host file)

Modifying your 'hosts' file enables you to override the DNS for a domain, on that particular machine.

This is useful when you want to test your site before changing your DNS, before you register the domain, or if its recently been registered and isn't yet resolving.

For Windows users:

Go to the Start Menu and search for Notepad.
Right click Notepad and select 'Run as administrator'.
Click Continue if prompted - you may need to enter your administrator password before being able to do this.

When Notepad opens, click File > Open.
In the File name field, type C:\Windows\System32\Drivers\etc\hosts
Click Open.

Now you need to enter the IP address of the server and your domain name. You should leave all other text as it is and simply add the extra lines to the end of the existing text.

You can obtain the server IP from your welcome email, or by looking in cPanel. If the IP was 123.123.123.123 and your site was domain.com, you'd add the following:

123.123.123.123 www.domain.com
123.123.123.123 domain.com

Click File > Save to save your changes.

Now when you visit domain.com, it will load from the IP you've put in the hosts file on the PC you've made this change on.

You should remove these lines to undo the change once you've finished doing your testing, just in case it causing confusion in the future.
To undo the changes, you simply follow the above instructions but instead of adding further lines, and simply remove the lines you added and save the file.

Was this answer helpful?

Add to Favourites
Print this Article

Also Read
Official cPanel Manual (Views: 2479)
Official WHM Manual (Views: 2251)
PHP Time Zone Errors (Views: 670)