Skip to content
Блог › CMS › How to Move a Website to a New Host Without Downtime

How to Move a Website to a New Host Without Downtime

The scary part of moving to a new host is the thought that the site will go down or email will get lost. In practice you can almost always avoid downtime: you set up the new server alongside the old one, test it, and only then switch the domain. Below is a step-by-step plan for WordPress, other CMSs, framework-based sites and VPS projects.

If you’d rather not do it yourself, open a ticket from your client area: our admins will move your site for free and without downtime.

Contents

What a zero-downtime migration looks like

The old hosting keeps running the whole time you set up the new one, so visitors notice nothing. Once the copy on the new server is tested, you change the domain’s DNS record and traffic gradually moves over. Keep the old hosting for a few more days as a fallback.

Downtime usually has one of three causes: DNS was switched before the new server was ready; email on the domain was forgotten; or new orders and comments arrived on the old site during the move and were lost.

Step 1. Lower the domain TTL a day ahead

TTL sets how long other servers remember your domain’s old IP address. If you lower the TTL of the A and www records to 300 seconds a day before the move, traffic will reach the new server within minutes of the switch instead of hours.

You change TTL wherever your domain’s DNS is hosted now: at the registrar, at your current host or in Cloudflare.

Step 2. Make a full backup

You need a backup even if you trust both hosts. Save:

  • all site files (for WordPress the key folder is wp-content);
  • a database dump in .sql format, via phpMyAdmin (Export) or mysqldump;
  • config files: .htaccess, wp-config.php or .env;
  • cron jobs, if you have any;
  • a list of mailboxes on the domain, if email is moving too.

For WordPress a backup plugin such as UpdraftPlus or All-in-One WP Migration is convenient. For large sites the manual way is more reliable: a file archive plus a separate database dump.

Step 3. Prepare the new hosting

Before you move anything, check the requirements:

  • the same PHP version as on the old host, or a newer one your CMS and plugins support;
  • the PHP extensions you need (for example intl, imagick, zip);
  • a MySQL or MariaDB version no older than before;
  • enough disk space, with room for backups.

Add the domain in the new control panel and create an empty database with a user. Small sites usually fit on shared hosting. For an online store with a large database or your own software, look at a VPS.

Step 4. Move files and the database

Upload files with an FTP/SFTP client (FileZilla, WinSCP) or the file manager in the panel. If both servers have SSH, copying directly is faster:

rsync -avz --progress user@old-server:/path/to/site/ /path/to/site/

Import the database through phpMyAdmin (Import) or from the console:

mysql -u db_user -p db_name < backup.sql

If the dump is too big for phpMyAdmin, ask the new host’s support to import it from the server console.

Step 5. Update the site configuration

The new server has different database credentials. Set the new database name, user and password in:

  • WordPress: wp-config.php (DB_NAME, DB_USER, DB_PASSWORD, DB_HOST);
  • Laravel and other frameworks: the .env file;
  • Joomla, OpenCart and other CMSs: their own config file.

If the domain or protocol changes along with the host (http to https), replace the old URLs in the database. In WordPress use the Better Search Replace plugin or wp search-replace in WP-CLI. A plain text replace in the SQL file can break serialized data, so avoid it.

Step 6. Test the site before switching

Open the site from the new server without touching DNS. Add a line with the new server’s IP to the hosts file on your computer:

203.0.113.10 example.com www.example.com

The file is at C:\Windows\System32\drivers\etc\hosts (Windows) or /etc/hosts (macOS, Linux). Remove the line when you’re done.

What to check:

  • the home page and a few inner pages, images, search;
  • logging in to the admin panel;
  • contact forms, the cart and checkout;
  • the PHP error log in the hosting panel.

Step 7. Switch the domain

There are two ways:

  • change the A record (and www) to the new server’s IP if DNS stays where it is. With a low TTL this is the fastest option;
  • change the domain’s nameservers to the ones your new host gave you. In that case copy every zone record first: A, MX, TXT (SPF, DKIM), CNAME. A nameserver change takes from a few hours to a day.

If your site takes orders, comments or sign-ups, switch during a quiet hour. Right before it, make a fresh database dump and import it again on the new server so the latest data isn’t lost. A store can turn on maintenance mode for 10–15 minutes.

Step 8. After the move

  • Issue an SSL certificate on the new hosting. Let’s Encrypt is free and can be issued as soon as the domain points to the new server.
  • Check email: if mailboxes stay with the old provider, the MX records must point to the same place as before.
  • Set up cron and backups on the new server.
  • Check Google Search Console for new crawl errors.
  • Keep the old hosting for 3–7 days until you’re sure everything works.

Notes for different projects

WordPress

The simplest case. Migration plugins move files and the database in one archive. After the move, go to Settings → Permalinks and click Save to refresh the .htaccess rules.

Other CMSs and static sites

A static site only needs its files copied. For Joomla, OpenCart or Drupal the order is the same: files, database, config file, testing.

Framework-based sites (Laravel, Django, Node.js)

Besides files and the database you need to restore dependencies (composer install, pip install, npm ci), environment variables, queues and background processes. These projects are usually better moved to a VPS, where you have full server access.

Moving from one VPS to another

First install the same versions of the web server, PHP or Python and the database on the new server. Then sync files with rsync, move the database, the web server config, cron and firewall rules. Right before switching, run rsync again and take a fresh dump to pick up changes made during the move.

Checklist

  • TTL of the A and www records lowered to 300 seconds a day ahead
  • Files, database dump and config files backed up
  • Same or newer PHP and database versions on the new hosting
  • Files and database moved, config updated
  • Site tested through the hosts file
  • Fresh database dump imported right before switching
  • DNS switched, MX and TXT records in place
  • SSL issued, email and forms working
  • Old hosting kept for a few more days

Want to move without the hassle? Open a ticket from your client area: we’ll move your site for free, test it, and switch the domain together with you.

1 thought on “How to Move a Website to a New Host Without Downtime”

  1. Pingback: Shared Hosting: What It Is and How to Choose | Hosting in Ukraine

Leave a Reply

Your email address will not be published. Required fields are marked *