Get the Best WordPress Backup
& Migration Plugin Today
Get Duplicator Now

Duplicator Documentation

Documentation, Reference Materials, and Tutorials for Duplicator

How To Migrate a Website With Zero Downtime

Are you looking to migrate a site with zero downtime? Usually, you would have to wait until a domain is set up and the DNS finishes updating in order to install a new website. In this guide, we will show you how to edit the hosts file so that you can migrate a website with zero downtime while the old site is still live.

Editing the Host File

Having little to no downtime when moving a site is ideal. To install the new site while the Domain is still pointing to the old server, you can force your computer browser into thinking the DNS has already been updated by editing the computer hosts file. You can then access the new website and install a backup from the original website.

Using Windows

    If you are using Windows, the best option is to open Notepad using administrator privileges.

    Search for “Notepad” on the Start menu, right-click on the Notepad icon, and then select “Run as administrator.” Click “Yes” on the prompt that appears.

    Next, go to File » Open and then navigate to C:\Windows\System32\drivers\etc folder. Finally, select the hosts file and open it. You may need to select “All files” for the file type before you can see the file.

    Using a Mac

    If you are using a Mac, then you need to open the Terminal app and enter this command to edit hosts file:

    sudo nano /private/etc/hosts

    You can then edit the host file using the nano program in the Terminal app.

    Changing the Domain

    For both Windows and Mac users, scroll down past all the lines that begin with #.

    Enter the IP address for the server, followed by a space, and then the domain for the website. For example, the following line would make the domain “www.example.com” point to a server with the IP address 192.168.1.22.

    192.168.1.22 www.example.com

    Be sure to save the file. You can now access your new website on your computer using the domain.

    Note: You may have to clear the browser cache first in order to access the site.

    Installing the backup

    Now you can install the website and launch it using the following steps.

    1. Browse to the installer.php and install the site. (See this guide for a full walkthrough.)
    2. Test to ensure everything is working
    3. When you are ready to launch the new site, go to your domain registrar and switch the Domain to your new host’s DNS servers
    4. After you are confident the DNS changes have propagated, remove the entry in your computers hosts file

    Important: Don’t forget to undo the changes you made to the hosts file after you have finished the migration.

    That’s it! We hope this guide helped you learn how to migrate a website with zero downtime.

    If WordPress is already installed on a new site, you can import a backup into WordPress. Check out our guide here to learn about “Importing a Backup using Duplicator Pro”.

    Was this article helpful?

    Related Articles