Skip to content
HOSTIGAN
WordPress

How to move your WordPress site to a new host (no downtime)

Migrate WordPress to new hosting without downtime: lower the TTL, copy files and database, fix URLs with WP-CLI, test via your hosts file, then switch DNS safely.

Intermediate 5 min read Updated November 24, 2026

Moving WordPress to a new host sounds risky, but it is mostly careful copying. The site is just files plus a database; you copy both, connect them on the new server, test, and only then point the domain across. Done in that order, visitors never see an error page. This guide takes you through the whole migration — preparation, export, import, URL changes, testing before DNS changes, and the switch itself — plus the errors you're most likely to meet on the way.

Prepare the move

A day or two before the migration:

  • Lower the DNS TTL on the domain's A and AAAA records to 300 seconds. When you change the records later, resolvers around the world will pick up the new address within minutes instead of hours. Our DNS guide explains TTL if it's new to you.
  • Take a full backup of files and database, and store it off the server — see how to back up WordPress.
  • Note the PHP version and extensions the old host uses, and pick the same or a newer supported version on the new host.
  • Check email. If your email is hosted with the old provider, don't touch the MX records unless you're moving email as well.
  • List the extras: cron jobs, custom .htaccess rules, redirects, subdomains and any files outside public_html that the site uses.

Tip: Plan the move for a quiet period and tell editors not to publish anything until it's done. Content added to the old site after you copy the database won't come along.

Step 1: export the database

In cPanel, open phpMyAdmin, select the WordPress database and use Export → Quick → SQL. With SSH access, WP-CLI is quicker and handles large databases better:

cd ~/public_html
wp db export ~/site.sql

Without WP-CLI, mysqldump does the same — the credentials are in wp-config.php:

mysqldump -u DB_USER -p --single-transaction DB_NAME > ~/site.sql

Step 2: copy the files

Pack the site into one archive, skipping cache folders you don't need:

tar -czf ~/site-files.tar.gz -C ~/public_html \
  --exclude='./wp-content/cache' .

Download it, or copy it straight to the new server if both have SSH:

scp ~/site-files.tar.gz ~/site.sql user@NEW_SERVER_IP:~

On hosting without SSH, download the folder through File Manager or SFTP instead. It's slower, but it works.

Step 3: import on the new host

  1. Create a new database and user on the new host and grant the user all privileges on it.
  2. Extract the files into the new document root:
tar -xzf ~/site-files.tar.gz -C ~/public_html
  1. Import the database:
cd ~/public_html
wp db import ~/site.sql
  1. Edit wp-config.php with the new DB_NAME, DB_USER, DB_PASSWORD and DB_HOST. Leave $table_prefix exactly as it was — if the old site used wp7x_, so must the new one.

Step 4: update URLs (only if the address changes)

If the domain stays the same, skip this. If you're also changing domain, switching from http to https, or moving out of a subfolder, the old address is stored throughout the database — including in serialized data that breaks if you edit the SQL file by hand. Use WP-CLI, which understands serialization:

wp search-replace 'https://old-example.com' 'https://example.com' --skip-columns=guid --dry-run
wp search-replace 'https://old-example.com' 'https://example.com' --skip-columns=guid
wp cache flush

The dry run shows how many replacements will happen in each table without changing anything. Skipping the guid column keeps feed readers from treating every post as new.

Warning: Never run find-and-replace on the .sql file in a text editor. Changing the length of a string inside serialized data corrupts it, and widgets or theme settings vanish without an error message.

Step 5: test before you switch DNS

You can see the new server while the rest of the world still uses the old one by editing your computer's hosts file.

On macOS or Linux:

sudo nano /etc/hosts

On Windows, open Notepad as administrator and edit C:\Windows\System32\drivers\etc\hosts. Add a line:

NEW_SERVER_IP  example.com www.example.com

Now your browser loads the site from the new server. Check:

  • the front page, inner pages and search,
  • logging in to wp-admin,
  • contact forms and, on a shop, the cart and checkout,
  • images (look for any still loading from the old domain).

A certificate warning is normal at this stage if the new host can't issue an SSL certificate until DNS points to it. When you're done, remove the line from the hosts file — otherwise you'll keep seeing the new server and won't notice problems others have.

Step 6: switch DNS

Update the A record (and AAAA for IPv6) to the new server's IP address, or change the nameservers if the new host also manages DNS. Our guide on pointing a domain to your server covers both routes.

Then:

  • Keep the old hosting running for at least a few days.
  • Avoid content changes until traffic has clearly moved.
  • Confirm the new host has issued an SSL certificate.
  • Raise the TTL back to a normal value (for example 3600) once everything is stable.

Using a migration plugin instead

If you don't have SSH access, or the site is small, a migration plugin can do steps 1 to 4 for you. Plugins such as Duplicator and All-in-One WP Migration package the files and database into one archive, which you then unpack on the new host with an installer script or by installing the same plugin on a fresh WordPress. They also handle URL changes safely.

Keep their limits in mind: free versions often cap the archive size, large uploads folders can hit PHP time-outs, and some hosts block very large uploads. If a plugin stalls, the manual method above always works. Whichever route you take, steps 5 and 6 — testing through the hosts file and switching DNS while the old site is still online — stay exactly the same.

Common problems after a move

  • "Error establishing a database connection." The details in wp-config.php are wrong, or the user wasn't granted privileges on the database.
  • 404 errors on every page except the front page. Go to Settings → Permalinks and click Save. On Apache, check that .htaccess was copied.
  • Redirects to the old domain. siteurl and home still hold the old address — run the search-replace from step 4.
  • White screen or error 500. Usually a PHP version or missing extension. See how to fix a 500 error.
  • Mixed content warnings. Some URLs still use http://. Run search-replace from http://example.com to https://example.com.
  • Missing widgets or theme settings. Serialized data was damaged, usually by a manual find-and-replace. Re-import the database and use WP-CLI instead.

In short

Lower the TTL, back up, copy files and database, keep the table prefix, change URLs only with WP-CLI, test through your hosts file, and switch DNS while the old site is still running. Your visitors won't notice a thing.

Moving to Hostigan

Whether you're moving a small site to WordPress hosting or a busy one to a VPS, the steps above apply. If you have questions before you start, our team is happy to help at info@hostigan.com.

Frequently asked questions

Not if you keep the old hosting running until DNS has switched over. Visitors are sent to either the old or the new server, and both serve the same site during the changeover.

Next in “WordPress that performs” · 7 of 7How to install WordPress on a VPS (Ubuntu 24.04, Nginx)