Just Host Web Hosting Help
How to Change your Hosts File
What is a Hosts File?
The hosts file will allow you to set IP addresses for domains on your local machine. These files can override the authoritative DNS settings for your domain, so this can be useful for seeing what a domain will display if pointed to a different server. A typical hosts file will have one or more lines referencing your 'localhost'(your computer).
This is very beneficial for development purposes, as it allows you to make changes on a server other than the one loaded by your domain when visitors access your page.
Editing your Hosts File
To change the host your domain loads from, you will need to know the correct IP for your server. Just Host servers will require you to use the IP address displayed under Server Information in your cPanel.
Editing System Files
You can change the host your local computer loads your website from by directly editing your system's hosts file. This method will be easier if you are an experienced user of the operating system on your local PC.
All operating systems will have a hosts file like our example:
- Replace "22.214.171.124" with the IP address from your cPanel.
- Replace "www.example.com" with your actual domain name.
To undo this change, deactivate the line by prefacing it with a "#" (as shown on the third line in the example above). This will cause the line to be ignored.
Remember to undo any changes you make after you're done previewing your site. Otherwise, any of these changes could prevent your domain from loading the correct DNS.
Once you have modified your hosts file, we recommend flushing your DNS cache to see the changes more quickly. For more information on flushing cache, please see DNS Cache Flush.