How can I test my website when my domain name isn’t pointing to it yet and it won’t work properly on a temporary URL?


Occasionally, a temporary URL will not be suitable to test your website before the domain name is pointing to it.  For example, if the website has rewrite rules that require the URLs to be in a certain format, or if all the links are absolute URLs instead of relative URLs.

What you can do to test your website is to update your computer’s hosts file.  This means that your computer will resolve the domain name to the server you are testing on, without the DNS being affected.  Your computer can access the website via the domain name, but the rest of the world cannot.

The hosts file for your computer will be:

Windows machines: C:\\Windows\System32\drivers\etc
Mac: /private/etc/hosts

Open the hosts file in a text editor, and add these lines to the end of the file:

[IP ADDRESS] [your-domain.com]
[IP ADDRESS] [www.your-domain.com]

Replace [IP ADDRESS] with the IP address of the server you are working on, and your-domain.com is the domain name you want the website to point to.

You can get the IP address from the temporary URL given in your eXtend Control Panel, or if you have VPS, a Hybrid Server, or a Dedicated Server, the IP address assigned to your server.

Save the changes you’ve made to your hosts file, then close and restart your web browser.  When you visit your-domain.com, it will resolve to the IP address, and you can test it to see how the site will be when it is live.

Once you have made the domain name live, you can delete that information from the hosts file.



Article ID: 65
Created On: Tue, Mar 3, 2015 at 4:54 PM
Last Updated On: Wed, Aug 18, 2021 at 3:52 PM

Online URL: https://www.heartinternet.uk/support/article/how-can-i-test-my-website-when-my-domain-name-isn-t-pointing-to-it-yet-and-it-won-t-work-properly-on-a-temporary-url.html