How to preview your website transfer before switching DNS?

We all know, the best practice to test a website transfer is to actually preview the site on the new host, this way you can see if all functionality is normal.

While a temporary url can be used, like the ones provided by Cpanel, Plesk, or a dedicated ip address, previewing the site from the actual domain name is even better.

Here is a quick and dirty trick to preview the website from a new hosting account, without actually changing the name servers:

By using the hosts file from your computer operating system, you can specify which ip address should be assigned to the domain name, so for instance if your new site ip address is xx.xx.xx.xx, then you can simply create an entry in your hosts files like this

xx.xx.xx.xx mydomain.com
xx.xx.xx.xx www.mydomain.com

Now next time when you open the site in your browser, it should be served from the server with ip address xx.xx.xx.xx specified in your hosts file. Note, that this change only takes effect on your local computer and does not affect other users; don’t forget to remove the entries once you are done.

As this wikipedia Hosts file tutorial indicates, the hosts files is located usually in

  • %SystemRoot%\system32\drivers\etc\ for Windows
  • /etc/hosts for most Linux distributions
  • /private/etc/hosts for OSX

This tutorial is specially good for web designers as i know temporary urls usually mess up with design structure.

If you have any additions to this, would be happy to hear from you and your usual practices when doing a site move.

    Comments

    1. Hunor says:

      Excellent! I did my site relocation using this trick.

    2. Thanks for this really useful tip. Why didn’t I think of that!

    2 responses so far. Leave a Comment

    Quick contact

    place

    Hi there, my name is Ovidiu Liuta and i support the XCloner! project
    XCloner is a Joomla backup component, Wordpress backup plugin and Free website backup tool.
    Contact me here!

    About company

    XCloner.com is a dynamic company focusing on providing backup and recovery solutions for small to medium websites.
    We are based in Romania and offer 24/7 support through forums and our private ticket system for Premium users support.

    © 2014 XCloner – Website Backup and Restore made simple
    All Rights Reserved | Privacy Policy