---
title: How to Migrate WordPress to a New Host With Almost No Downtime
description: "How to migrate WordPress to a new host: copy the site, test it before the DNS change, lock the old site and switch with only minutes of maintenance."
url: "https://skybootstrap.com/migrate-wordpress-to-new-host/"
canonical_url: "https://skybootstrap.com/migrate-wordpress-to-new-host/"
date: "2026-11-26T06:07:00+06:00"
modified: "2026-11-16T17:04:23+06:00"
author: Skybootstrap Team
type: article
site: SkyBootstrap
language: en-US
---

# How to Migrate WordPress to a New Host With Almost No Downtime

To migrate WordPress to a new host with almost no downtime, lower your DNS TTL a day ahead and copy the site while the old host keeps running. Test the copy by name, then lock the old site, copy the database again, and switch DNS. The only downtime is a maintenance page during the switch.

We moved our own test site to a second server address with a new database and database user, and timed each step. Three things went wrong on the way that the usual guides don’t mention: a shortcut file still pointing at the old server, a post lost during the switch, and a maintenance lock that expired by itself.

![Diagram of how to migrate WordPress to a new host: copy the site, test it by name, lock the old site, copy the database again, switch DNS, cancel the old host later](https://skybootstrap.com/wp-content/uploads/2026/11/migrate-wordpress-to-new-host-switch-order.webp "The order this guide uses; steps 1 to 5 ran on our test site (WordPress 7.1.4), 11 Nov 2026.")

## Before you migrate WordPress: lower the DNS TTL

Before you migrate WordPress, lower the TTL on your site’s DNS record a day or more ahead, so visitors reach the new host soon after the switch. DNS tells browsers which server your domain points to; each record’s TTL, short for time-to-live, is how many seconds other servers may keep a saved copy.

[DNSimple’s guide](https://support.dnsimple.com/articles/what-is-ttl/) puts it this way: the TTL “tells resolvers how long they can keep using a cached copy”. That’s why a switch isn’t instant: a visitor whose provider saved your old address keeps reaching the old host until that copy runs out. DNSimple’s advice: “When you expect to change a record, lowering its TTL beforehand means resolvers pick up the change sooner.”

So, at your DNS provider, lower the TTL on the record that points at your site, usually an A record. Do it at least one old TTL ahead: with a 24-hour TTL, a day before the move. ServMask’s migration guide suggests 300 seconds, 24 to 48 hours ahead. We couldn’t test real DNS from our lab, so this part rests on those two guides.

Two more jobs before you start:

- **Back up the site.** If anything goes wrong, you still have a copy that doesn’t depend on either host. Our backup guide has the commands.
- **Find out where your email runs.** Your MX record names the server that accepts your mail, and [DNSimple’s MX guide](https://support.dnsimple.com/articles/mx-record/) says that name “must resolve to an A or AAAA record”. If it names your own domain, or a mail host on the site’s IP address, changing the website’s A record moves your mail to the new host too. Set up mailboxes there first, or point MX at your mail provider. [Kinsta’s guide](https://kinsta.com/blog/migrate-wordpress/) adds that if you use the domain for email, “you won’t want to change the nameservers”. We didn’t test email.

## Pick a route: your new host, a plugin, or by hand

You can copy the site with your new host’s migration service, a plugin, or by hand. We tested only the manual route; here’s what to ask of the other two:

- **Your new host’s migration service.** Some hosts copy the site for you. Ask whether they also handle DNS, and whether they test the copy before you switch.
- **A migration plugin.** Duplicator and All-in-One WP Migration are the two the top guides use. Large sites can hit the new host’s upload limit; ServMask’s guide says its free plugin has no import limit of its own, but the host’s `upload_max_filesize` and `post_max_size` still apply.
- **By hand.** You move the folder and the database with a few commands. It needs a command line on both hosts (SSH) with WP-CLI, the official WordPress command-line tool. It’s the route we tested.

Whichever route copies the site, the testing and switching steps further down are the same. They use WP-CLI too; without SSH, ask your host whether its panel has a terminal, or use the panel route we give there. To try a change on a copy without moving at all, set up a staging site instead.

## Migrate WordPress to the new host by hand

To migrate WordPress by hand, you carry two things to the new host: the database and the site’s folder. On the old host, run these from your home folder, changing the path to your site’s folder:

```
wp --path=/home/youruser/public_html db export ~/move-db.sql
tar -czf ~/move-files.tar.gz -C /home/youruser public_html
```

On cPanel, `public_html` can also hold other sites’ folders (addon domains); leave those out of the archive.

Copy both files to the new host, with SFTP or `scp`. In the new host’s panel, create an empty database and a database user with access to it. Empty the new `public_html` folder (`ls -A` should print nothing), then unpack and connect the site to its new database. Run these as the new host’s site user, not root:

```
tar -xzf ~/move-files.tar.gz -C /home/newuser
wp --path=/home/newuser/public_html config set DB_NAME newuser_wp
wp --path=/home/newuser/public_html config set DB_USER newuser_wp
wp --path=/home/newuser/public_html config set DB_PASSWORD 'the-new-password'
wp --path=/home/newuser/public_html db import ~/move-db.sql
```

The wp-config.php file holds your database name, user and password, so it has to match the new host’s database. The password also lands in your shell history, so clear it there if others share the account. If your host gave you a different database server than `localhost`, set `DB_HOST` the same way. If any of these values is wrong, WordPress shows “Error establishing a database connection”; our [guide to that error](https://skybootstrap.com/error-establishing-a-database-connection/) finds which one.

On our test site, the export took 0.15 seconds and the archive about 7 seconds. Unpacking on the new host took 1.4 seconds and the import 0.24 seconds. Afterwards, the new host had the same 60 posts, 12 tables and home address as the old one.

Our move needed no search-replace step. The domain stayed the same, and our database didn’t contain the old server’s folder path even once. The [WordPress handbook](https://developer.wordpress.org/advanced-administration/upgrade/migrating/) agrees: “If database and URL remain the same, you can move by just copying your files and database.” If you’re changing the domain too, our domain change guide covers that.

Some plugins do save full folder paths, though, and those break if your folder name changes on the new host. Count them in the dump before you import:

```
grep -c '/home/youruser/' ~/move-db.sql
grep -l '/home/youruser/' /home/newuser/public_html/wp-config.php /home/newuser/public_html/.htaccess /home/newuser/public_html/.user.ini
```

Ours printed 0. If yours finds the old path, run `wp search-replace '/home/youruser/' '/home/newuser/'` on the new host after the import, and edit any file the second line names. We didn’t need either step.

Files can still point at the old server. Our copy had a symlink, a shortcut file left by the Query Monitor plugin, and it pointed at the old host’s folder by its full path. This lists any such shortcuts:

```
find /home/newuser/public_html -type l -lname '/home/youruser/*'
```

Replace `/home/youruser` with the old host’s folder, then point each result at the matching file in the new folder, or delete it and reinstall the plugin that made it.

## Test the new host before you change DNS

Test the new host by name before the world sees it. Your hosts file lets you do that: it’s a small file on your own computer that overrides DNS for the names you list. Add a line with the new host’s IP address and your domain:

```
203.0.113.10 example.com www.example.com
```

On Windows, the file is `C:\Windows\System32\drivers\etc\hosts`; open Notepad as administrator to edit it. On a Mac or Linux, it’s `/etc/hosts`, edited with `sudo`. Only your computer now sees the new host, so visitors still get the old one.

To check a page without touching the file, `curl` can do the same for one request:

```
curl -sSI --resolve example.com:443:203.0.113.10 https://example.com/
```

If the new host has no certificate for your domain yet, this prints a certificate error instead of headers, and a browser shows a warning. That’s expected until the certificate exists. We tested over plain `http` only.

That’s how we tested ours. The homepage, the login page and a post all loaded from the new server, and the homepage’s 315 links still used the real domain. (Our lab used port 8084 instead of 443.)

We didn’t change the site’s address in the database. The handbook says testing first needs a temporary change to “siteurl” and “home”; reaching the new host by name made that unnecessary.

Log in, open a few posts, submit a form and check the images. Scheduled jobs didn’t run on our new host during the preview: WordPress starts them by calling its own address, which from the new server still led to the old host. A server cron job that runs them directly did run them, so if your new host has one set up for WordPress, pause it until after the switch, especially on a shop or membership site.

If you have an SSL certificate, set it up on the new host before switching, so `https://` works from the first visit. We didn’t test certificates; ask your new host how to issue one before DNS points there.

## Lock the old site, copy the database again, switch DNS

The old site keeps running while you test, so anything written there after your export doesn’t exist on the new host. When we published a post on the old host after the export, the new host never got it. So lock the old site first, copy the database again, and only then switch DNS.

Maintenance mode is the “Briefly unavailable for scheduled maintenance” page WordPress shows during updates. WP-CLI has a command for it, `wp maintenance-mode activate`, but it doesn’t last. It writes a fixed time into a file called `.maintenance`, and WordPress ignores that file once the time is 10 minutes old. With the time set 11 minutes back, our old site loaded normally again.

So write the file yourself, with a time that’s always now:

```
echo '<?php $upgrading = time(); ?>' > /home/youruser/public_html/.maintenance
```

With that file, our old host answered the homepage, the login page and comment posts with the maintenance page and a 503 status. WP-CLI still worked, so the final copy ran while the site was locked:

```
wp --path=/home/youruser/public_html db export ~/move-db-final.sql
wp --path=/home/newuser/public_html db import ~/move-db-final.sql
```

In our tests, this second copy brought over the post the new host had missed, and it ran just as well with the old site locked. Each time, it took under half a second. The new host’s wp-config.php kept its own database settings. If you uploaded media since the first copy, copy `wp-content/uploads` again too.

Now change every DNS record that points at the old host’s IP address: the A record, any AAAA (IPv6) record, and `www` if it has a record of its own. A record you miss keeps sending its visitors to the locked old site.

When we switched (our lab changed its hosts file in place of DNS), new lookups reached the new server at once. A client that still held the old address kept reaching the old host, which now showed the maintenance page instead of taking posts you’d lose. That page is the downtime, and it ends for each visitor when their saved copy of your old address runs out: at most the TTL you set.

Without SSH, the same steps work through your hosting panel, though we didn’t test this route. Create the `.maintenance` file with that one line in the old host’s file manager. Then export the database in the old host’s phpMyAdmin, and import it in the new host’s phpMyAdmin after removing the tables from the first copy.

Delete the `.maintenance` file only if you need the old site back; the stuck maintenance mode fixes cover that file in more detail.

## After the move: checks and when to cancel the old host

Once DNS points at the new host, finish with these checks:

- **Remove the hosts line** from your computer, so you see what visitors see.
- **Check the site from outside**, logged out: homepage, a post, a form, an image, and the login page.
- **Clear any cache or CDN** that still holds pages from the old host.
- **Check permalinks.** The handbook says to “reconfigure permalinks when it goes live”. If posts return a 404 on the new host, our 404 fixes cover it; our nginx test site didn’t need any.
- **Raise the TTL back** after the move. DNSimple recommends “raising the TTL back to at least 1 hour.”
- **Make a fresh backup** on the new host; your last one came from the old host.

Keep the old host for at least a week before you cancel it. WPBeginner suggests waiting “7 days after your migration”, ServMask 7 to 14 days. It’s your fallback if something turns up late, and our restore guide shows how to bring files back from it. After that, delete the old site and its database.

The WordPress maintenance checklist covers the routine jobs once the site has settled in. For a move from your own computer rather than another host, see our localhost to live guide.

## How we tested

We moved our test site (WordPress 7.1.4) to a second IP address on our lab server, standing in for a new host. It had its own folder, database and database user; the tools were WP-CLI 2.12.0 and tar 1.35. We timed each step and reached the new host by name before the switch.

To see what gets lost, we wrote a post on the old host after the export. We then locked the old host, ran the final copy and checked which requests the lock stopped. A hosts file change stood in for the DNS switch, and we checked whether scheduled jobs ran during the preview. We didn’t test real DNS, SSL certificates, email, host migration services, plugins or sites larger than ours.

## Frequently Asked Questions

### How long does it take to migrate WordPress to a new host?

Copying a WordPress site takes minutes for a small one: our 240 MB test site took about 9 seconds of commands, plus the time to transfer the files. The longer wait is DNS: visitors move over as their saved copy of your old address runs out, which depends on the TTL. Until then, they see the old site’s maintenance page.

### Do I need to change URLs when I move WordPress to a new host?

URLs don’t change when the domain stays the same. The handbook says you can move “by just copying your files and database”, and our test site needed no search-replace. You only change URLs when the domain itself changes.

### Will my email stop working when I change hosts?

Email can move with the website without you noticing. If your MX record names your own domain or a mail host on the site’s IP address, changing the A record sends mail to the new host, so set up mailboxes there first. Mail handled by an outside provider isn’t affected by the A record. We didn’t test email.