
To move a WordPress site to a new host without downtime: take a full backup, copy the files and database to the new server (with a migration plugin or manually), update wp-config.php with the new database details, test the site on the new server before changing DNS by editing your computer's hosts file, then point the domain to the new server and keep the old one running for a couple of days. Email, SSL and scheduled tasks need their own checks. This guide covers both the plugin method and the manual method, with the exact commands. This guide explains how to migrate WordPress to new host step by step.
- Never cancel the old hosting until the new site, email and SSL are confirmed working.
- Lower the DNS TTL a day before the move so the switch is quick.
- Test on the new server through your hosts file before changing DNS.
- If the domain or URL changes, run a serialisation-safe search and replace, not a plain SQL replace.
Step 1: Prepare
- Take a complete backup (files and database) and download it. See our backup guide.
- Note the PHP version, PHP extensions and memory limit on the old host, and match them on the new one.
- List everything that is not WordPress: email accounts, subdomains, cron jobs, other folders.
- Lower the TTL of your DNS records to 300 seconds at least a day before. Our DNS guide explains why.
- Pause content changes and, for stores, schedule the move for a quiet time.
Option A: Migrate with a plugin
| Plugin | Notes |
|---|---|
| All-in-One WP Migration | Simple export/import file; free version has an upload size limit |
| Duplicator | Creates a package and an installer script for the new server |
| Migrate Guru | Server-to-server transfer, good for large sites |
| Host migration tools | Many hosts, including Hostinger and others, offer free migration |
Install WordPress on the new server, install the same plugin, import, then log in with the old site's credentials. Plugins work well for most sites under a few gigabytes.
Option B: Migrate manually
1. Export the database from phpMyAdmin (Export → Quick → SQL) or with WP-CLI over SSH: Also, this is one of the easiest ways to migrate WordPress to new host.
wp db export site.sql
2. Copy the files. Compress the site folder and download it, or copy server to server:
# On the old server
tar -czf site.tar.gz -C /home/user/public_html .
# On the new server
scp user@old-server:/home/user/site.tar.gz .
tar -xzf site.tar.gz -C /home/newuser/public_html
3. Create a new database and user in the new hosting panel, then import:
wp db import site.sql
# or: mysql -u newuser -p newdb < site.sql
4. Update wp-config.php:
define( 'DB_NAME', 'newdb' );
define( 'DB_USER', 'newuser' );
define( 'DB_PASSWORD', 'use-the-new-password' );
define( 'DB_HOST', 'localhost' );
Check whether the table prefix ($table_prefix) matches the imported tables.
Migrate WordPress to new host: if the domain or URL changes
WordPress stores URLs inside serialised data, so a plain SQL find-and-replace can corrupt widgets and settings. Use WP-CLI or a plugin like Better Search Replace:
wp search-replace 'https://old-domain.com' 'https://www.new-domain.com' --skip-columns=guid --dry-run
wp search-replace 'https://old-domain.com' 'https://www.new-domain.com' --skip-columns=guid
Run the dry run first to see how many replacements will happen. Then set up 301 redirects from the old domain; see our redirects guide.
Step 2: Test before switching DNS
Point your own computer at the new server while everyone else still sees the old one. Edit the hosts file:
- Windows:
C:\Windows\System32\drivers\etc\hosts(open Notepad as administrator) - macOS and Linux:
/etc/hosts
203.0.113.25 example.com
203.0.113.25 www.example.com
Then browse the site and check: home page, inner pages, images, forms, login, checkout for stores, and permalinks (if inner pages show 404, re-save Settings → Permalinks). Remove the lines after testing.
Step 3: Switch DNS and finish
- Update the A record (or nameservers) to the new server.
- Issue the SSL certificate on the new host once the domain resolves there, and confirm HTTPS works without warnings.
- Recreate email accounts and MX records if email moves too, or keep MX pointing to your email provider.
- Set up cron jobs, server-side caching and backups on the new host.
- Keep the old hosting live for 48 to 72 hours. For stores, check the old server for any orders placed during the switch.
- Clear caches and test speed; see how to check website speed.
Migrate WordPress to new host: common migration problems
| Problem | Likely fix |
|---|---|
| "Error establishing a database connection" | Wrong DB name, user, password or host in wp-config.php |
| Inner pages 404 | Re-save permalinks; check .htaccess copied (hidden file) |
| Images missing | wp-content/uploads not fully copied, or old URLs in content |
| Redirect loop | siteurl/home mismatch or SSL settings; see our too many redirects guide |
| White screen or critical error | PHP version or missing extension; see our critical error guide |
Migrate WordPress to new host: frequently asked questions
Migrate WordPress to new host: will moving hosts affect my SEO?
Not if URLs stay the same and downtime is avoided. Rankings depend on content and URLs, not on which server hosts them.
How long does a migration take?
The copy usually takes under an hour for a small site. DNS changes then reach most visitors within minutes to a few hours if TTL was lowered.
Related guides: WordPress Security Hardening, How to Update the PHP Version of Your WordPress Site Safely and How to Speed Up a WordPress Website.
For official guidance, see the official WordPress documentation.
Want us to move your site?
We migrate WordPress sites and stores with no downtime and no lost orders as part of our hosting and maintenance services. Contact us.
Written by the ItsWebExpert team, a web design and development company in Karachi building websites, online stores and apps for businesses across Pakistan.
Ask a Question on WhatsApp