Moving a WordPress site to a new host does not have to mean a maintenance page and a weekend of worry. If you copy the site first, test it on the new server before anyone else can see it, and only then point your domain at it, visitors never notice the move.
This guide walks through that order step by step for a move to cPanel hosting, including the DNS and email records that most often go wrong.
The idea in one paragraph
Your domain’s DNS decides which server visitors reach. Until you change it, everyone keeps using the old host. That gives you a window to build and test a full copy of the site on the new host. When the copy is right, you change one DNS record, and traffic moves across as DNS caches expire. Both servers serve the same site during the switch, so there is no gap.
Step 1: lower your DNS TTL a day or two ahead
TTL (time to live) tells resolvers how long they may cache a DNS answer. Many records are set to several hours. If you switch with a long TTL, some visitors keep reaching the old server for that long.
At least a day before the move, find the A record for your domain (and the www record, whether it is an A record or a CNAME) at your current DNS provider and set the TTL to 300 seconds. Wait for the old TTL to run out before you switch, so the short value is what resolvers have cached.
Step 2: take a full backup
Before you copy anything, make a backup you can restore on its own:
- Files: the whole WordPress folder, including
wp-content(themes, plugins and uploads),wp-config.phpand.htaccess. - Database: a full export as a .sql file, from phpMyAdmin or with
wp db exportif you have WP-CLI.
Download both to your own computer. This is your safety net if anything goes wrong on either server.
Step 3: copy the files to the new host
In your new cPanel account, add your domain if it is not already the main domain, and note its document root, usually public_html.
Upload the files with whichever tool suits you:
- cPanel File Manager: upload a .zip of the site, then extract it in place. This is the quickest for most sites.
- SFTP with a client such as FileZilla.
- rsync or scp over SSH, if both hosts give you shell access. This is the fastest for large uploads folders.
Check the new host runs the same or a newer PHP version than the old one, with the same extensions. You can pick the PHP version in cPanel.
Step 4: create the database and import it
- In cPanel, open MySQL Databases. Create a database and a user with a strong password, then add the user to the database with all privileges.
- Open phpMyAdmin, select the new database and import your .sql file. For a very large database, import over SSH with
wp db importor themysqlcommand. - Edit
wp-config.phpon the new server and updateDB_NAME,DB_USERandDB_PASSWORD.DB_HOSTis usuallylocalhoston cPanel. Leave$table_prefixas it was.
Because the domain is not changing, you do not need to search and replace URLs in the database. If you did move to a new domain, run wp search-replace on the new copy, which handles serialized data safely.
Step 5: test with a hosts-file entry
This is the step that makes a no-downtime move possible. Your computer’s hosts file lets you send your own browser to the new server while the rest of the world still reaches the old one.
Add one line with the new server’s IP address (shown in cPanel) and your domain names:
203.0.113.10 example.com www.example.com
- Windows: edit
C:WindowsSystem32driversetchostsin Notepad opened as administrator. - macOS and Linux: edit
/etc/hostswithsudo.
Close and reopen your browser, then work through the site:
- The home page, a few posts and pages, and the images on them.
- Logging in to
wp-adminand saving a draft. - Contact forms, search, and the checkout if you run a shop.
- Permalinks: if inner pages return 404, go to Settings > Permalinks and click Save to rebuild
.htaccess.
Expect a certificate warning while you test. Free SSL certificates are usually issued once the domain points at the new server, so the new host may not have one for your domain yet. The warning goes away after the switch. Remove the hosts line when you are done testing.
Step 6: keep your email working
This is where most moves cause real trouble. Your website and your email are separate services, even if they share a domain, and you only want to move the website.
If you are changing just the A records at your current DNS provider, your email records stay as they are. If you are also changing nameservers to the new host, every record has to be copied across first, or email stops the moment the nameservers change. Copy these exactly:
| Record | Type | Host | What it does |
|---|---|---|---|
| MX | MX | @ | Where incoming mail is delivered, with priorities |
| SPF | TXT | @ | Which servers may send mail for your domain |
| DKIM | TXT or CNAME | selector._domainkey |
The public key that verifies your mail signatures |
| DMARC | TXT | _dmarc |
Your policy for mail that fails SPF and DKIM |
| Mail client settings | CNAME, A or SRV | mail, autodiscover, autoconfig | How Outlook and phones find your mail server |
| Verification records | TXT | @ or a named host | Proof of domain ownership for other services |
Not sure which records your email needs? See which records to add to make your email work and how to set a DKIM record.
One more cPanel setting matters if your email is hosted somewhere else. Open Email Routing in cPanel and choose Remote Mail Exchanger. Otherwise the server may treat your domain’s mail as local, and messages from your website’s contact form to your own address never reach your real inbox.
Step 7: switch DNS
Pick a quiet time. If the site takes orders, comments or form entries that write to the database, pause them briefly, re-export the database from the old host and import it on the new one so nothing is lost.
Then change the A record for your domain (and www) to the new server’s IP address. With a 300-second TTL, most visitors move across within minutes. Some resolvers take longer, which is why you leave the old site running.
Step 8: check, then tidy up
- Use a DNS lookup tool to confirm your domain resolves to the new IP address.
- Confirm SSL is issued on the new host. In cPanel, SSL/TLS Status lets you run AutoSSL if it has not run yet.
- Send a test email to and from your domain, and submit a contact form on the site.
- Clear any caching plugin, and check the site loads from a phone on mobile data.
- Keep the old hosting for a week or two before you cancel it, in case something was missed.
- Raise the TTL back to a normal value once everything is settled.
Want us to do the move?
CloudWish cPanel hosting runs on LiteSpeed web servers and NVMe storage, with free SSL and daily backups on every plan, from $3.95 a month. Website migration is free: tell us where your site lives today and we move it for you.