Migrating Your Website To New Server Without Down Time

Migrating your site to new server need to repoint your domain nameserver to new server. DNS propagating need maximum 48 hours to update. So when you visit your site in old server for the last 48 hours then your DNS server still cache your domain, you have to wait maximum 48 hours to see the new server.

This down time can be avoid by setting your website to new server prior repoint your domain. But how to do that, you new server only accessible with IP address or server domain, because your domain still pointing to old server or still propagating.

The Domain Name System makes it possible to assign domain names to groups of Internet resources and users in a meaningful way, independent of each entity’s physical location. Because of this, World Wide Web (WWW) hyperlinks and Internet contact information can remain consistent and constant even if the current Internet routing arrangements change or the participant uses a mobile device. The Domain Name System distributes the responsibility of assigning domain names and mapping those names to IP addresses by designating authoritative name servers for each domain.

Anyway there is a simple trick to migrating your website without downtime. You can migrate your website to new location or server prior you change or repoint your domain nameserver. The basic idea of this trick actually give your computer the exact ip address of your new server without requesting the address from the DNS server.

How to do that in Windows

  1. Open the hosts file with notepad:
    Windows 95/98/Me c:windowshosts
    Windows NT/2000/XP Pro c:winntsystem32driversetchosts
    Windows XP Home c:windowssystem32driversetchosts
    Windows Vista/7: C:WindowsSystem32driversetchosts
    Note: In Windows Vista or Windows 7 you need to open the notepad with administrator privileged.
  2. Add your domain at the end of the file with this template:
    xxx.xxx.xxx.xxx    yourdomain.com
    xxx.xxx.xxx.xxx    www.yourdomain.com

    example:    ivankristianto.com    www.ivankristianto.com

For Ubuntu or other Linux

  1. Edit the /etc/hosts:
    vim /etc/hosts 
  2. Add your domain with the following format:
    <ip> <hostname>.<domain> <alias>

    Example:    ivankristianto.com    www.ivankristianto.com

For Mac OSX

  1. Edit /private/etc/hosts.
    sudo nano /etc/hosts 
  2. Add your domain with the following format:
    xxx.xxx.xxx.xxx    yourdomain.com
    xxx.xxx.xxx.xxx    www.yourdomain.com

    Example:    ivankristianto.com    www.ivankristianto.com

Now when you go to your domain, it will point to your new server. Configure and test your website on the new server. Don’t forget to configure your email account and email forwarding if any. So after you think it’s okay to go live, then update your nameserver, and live it for a while until it full propagated. To test your website from all over the world you can use host-tracker. See if all your domain to propagate to new server.

That’s it for now. If you have more tips and tricks, please leave a comment below. Thanks.

Give me your feedback

This site uses Akismet to reduce spam. Learn how your comment data is processed.