How to Move a WordPress Site to Another Host
Migrate WordPress with no downtime. Plugin route or manual, how to test on the new server before changing DNS, and how to avoid losing email or emptying the cart.
Moving a WordPress site sounds risky and mostly is not — provided you do one thing: test the site fully on the new server before you point the domain at it.
That single habit turns a nervous migration into a boring one. Here is the whole process both ways, plus the details that catch people out.
Two days before: lower your DNS TTL
Do this first, because it takes time to take effect.
TTL tells the internet how long to remember your DNS records. The default is often 24 or 48 hours, which means some visitors keep reaching the old server for two days after you switch.
In your DNS panel, change the TTL on the A record to 300 seconds. Wait for the old TTL to expire, then migrate. The switch then propagates in about five minutes instead of two days.
Raise it back to a normal value once everything is settled.
Before you start: what you are moving
A WordPress site is exactly two things:
- The files — WordPress core, themes, plugins, uploads
- The database — posts, pages, settings, users, comments
Miss either and the site does not work. Everything below is just moving both safely.
Method 1: A migration plugin
The right choice for most sites. Duplicator, All-in-One WP Migration or Migrate Guru all work.
On the old host
- Install the plugin and run the export
- It builds one archive containing files and database together
- Download it, plus the installer file if the plugin provides one
On the new host
- Create an empty database, a user, and grant all privileges. Note all three.
- Upload the archive and installer to the new server's web root
- Open the installer in a browser — using the server IP or a temporary URL, not the domain, which still points elsewhere
- Enter the database details and run it
Free tiers have size limits. All-in-One WP Migration caps free imports at a few hundred megabytes. A media-heavy site will exceed it, and then the manual method below is faster than paying.
Method 2: Manual migration
More steps, no size limits, and nothing hidden from you.
1. Export the database
cPanel → phpMyAdmin → select the database → Export → Quick → SQL → Go.
For a large database use Custom and tick Add DROP TABLE, which makes re-importing cleaner if you have to retry.
2. Download the files
The fastest route is to zip on the server first: File Manager → select all in public_html → Compress → download the zip. Downloading thousands of small files over FTP takes hours; one zip takes minutes.
3. Upload to the new host
Upload the zip into public_html on the new server and extract it there.
4. Import the database
Create the database and user on the new host, then phpMyAdmin → select it → Import → choose your SQL file → Go.
If the file is too large to upload, use the SSH route:
mysql -u newuser -p newdatabase < backup.sql
5. Update wp-config.php
define( 'DB_NAME', 'new_database' );
define( 'DB_USER', 'new_user' );
define( 'DB_PASSWORD', 'new_password' );
define( 'DB_HOST', 'localhost' );
Some hosts use something other than localhost — check their documentation.
Test before you switch the domain
This is the part that makes migration safe, and almost nobody does it.
Edit the hosts file on your own computer so that your machine resolves the domain to the new server, while the rest of the world still reaches the old one.
Windows: C:\Windows\System32\drivers\etc\hosts (open Notepad as administrator)
Mac and Linux: /etc/hosts
Add one line:
203.0.113.45 yourdomain.com
203.0.113.45 www.yourdomain.com
Use the new server's IP. Save, then open your domain in a browser — you are now seeing the new server while everyone else sees the old one.
Check all of this
- The homepage and several inner pages
- Images actually load
- Log in to wp-admin
- Submit the contact form and confirm the email arrives
- Search
- If it is a shop: add to cart, reach checkout
- Open it on a phone
Found a problem? Fix it with zero pressure — the live site is untouched. When everything works, remove the hosts lines.
Switch the domain
Change the nameservers at your registrar to the new host's, or update the A record to the new IP.
With TTL already lowered, most visitors move within minutes.
Keep the old hosting running for at least a week. It costs a few dollars and gives you somewhere to go back to. Cancelling immediately is the one mistake with no recovery.
After the switch
- Install SSL on the new host. The old certificate does not travel. See the WordPress SSL guide.
- Re-save permalinks — Settings → Permalinks → Save. This rewrites
.htaccesson the new server. - Clear every cache — plugin, host and Cloudflare.
- Check Search Console for a spike in crawl errors over the next few days.
- Test email again from the live domain, not just the hosts-file version.
Email — the thing people forget
If your email is on the same host as the website, moving nameservers moves your email too. Messages start arriving at a new, empty mailbox on a server you have not configured.
Before switching, decide:
- Email staying where it is? Copy the existing MX records to the new DNS before the change. Check them twice.
- Email moving too? Create the mailboxes on the new host first, and download anything important from the old ones.
- Using Google Workspace or similar? Copy those MX records across exactly.
Lost email is worse than a broken website, because you cannot tell what you missed.
Common problems
"Error establishing a database connection"
Wrong credentials in wp-config.php, or the user was not granted privileges on the database. Test directly:
mysql -u newuser -p newdatabase
The homepage works but every other page is 404
.htaccess did not transfer, or AllowOverride All is missing on the new server. Re-save permalinks first; if that fails, it is the Apache config.
The site loads but has no styling
Old URLs in the database, usually if the domain or protocol changed. Run a search and replace with Better Search Replace or WP-CLI.
Images are missing
The uploads folder did not transfer completely, or permissions are wrong. Check wp-content/uploads exists and is owned by the web server user.
Some visitors see the old site
Normal during propagation. It resolves as caches expire — faster if you lowered the TTL in advance.
The site is slower than before
Caching plugins store server-specific paths. Deactivate, reactivate and reconfigure the caching plugin on the new host.
A safe order of work
- Two days before: lower DNS TTL to 300
- Sort out the email plan
- Back up files and database, and keep a copy off both servers
- Move everything to the new host
- Test with the hosts file until it is genuinely finished
- Switch DNS
- Install SSL, re-save permalinks, clear caches
- Watch for a week, then cancel the old host