Guide Migrations & Transfers

How to migrate a site from a cPanel host

Getting the files and database out of cPanel is the easy part — the order you copy, test and switch DNS in is what actually protects you.

Updated 10 min read Intermediate

cPanel is the control panel on the host you are leaving, not something you will see again once the move is done — your account with us runs on StackCP instead. This guide is entirely about getting your site out of a cPanel host correctly: what to export, what cPanel hides from a simple file copy, and the order to bring it all across in.

The order does not change just because the source is cPanel

Copy first. Test second. Switch DNS last. cPanel gives you a few extra export tools, which this guide covers, but the sequence that prevents downtime is exactly the same as any other migration.

What lives inside a cPanel account

cPanel accounts tend to accumulate configuration in places a plain file copy will not reach:

  • Website files, normally inside public_html, sometimes with the actual site one folder deeper if an add-on domain is involved.
  • One or more MySQL databases, each needing its own export.
  • Email accounts and forwarders, set up through cPanel's mail tools rather than as files.
  • Cron jobs, configured in cPanel's Cron Jobs section.
  • Redirects and custom DNS records, set up through cPanel rather than at the registrar.
  • SSL certificates — usually not worth exporting, since a new certificate is normally issued automatically on the new host once DNS points at it.

Step 1 — Export the files

In cPanel's File Manager, select everything inside public_html and compress it, or connect over FTP/SFTP and download the folder directly. Either way, make sure hidden files are visible first — .htaccess starts with a dot and most FTP clients hide it unless you turn that setting on.

Step 2 — Export every database

Open phpMyAdmin from inside cPanel, select each database the site uses, and export it as a .sql file. A site can quietly use more than one database — check cPanel's MySQL Databases section for the full list rather than assuming there is only the one the CMS created.

For a database too large for phpMyAdmin's upload limit on the way back in, the command line handles it without complaint:

mysql -u newuser -p newdatabase < backup.sql

Step 3 — List what is not in a file export

This is the step people skip, and it is why "the site works but email/forms/scheduled posts stopped" is the most common post-migration surprise. Before leaving the cPanel account, write down:

  • Every mailbox and forwarder, so they can be recreated on the new host.
  • Every cron job, with its schedule and command.
  • Any redirect or custom error page configured through cPanel rather than in .htaccess itself.

Step 4 — Set up the new account

Create the domain, an empty database and a database user on the new host, matching the PHP version cPanel was running so the migration and any version upgrade are not happening at the same time.

Step 5 — Import and reconnect

Upload the files into the new web root and import the .sql export into the new empty database. Then edit the site's configuration file with the new database name, user and password:

PlatformFile to edit
WordPresswp-config.php
Joomlaconfiguration.php
Laravel.env
Drupalsites/default/settings.php

A mismatch here produces a database connection error, which is a clear signal something in this step needs another look — see fixing a database connection error.

Step 6 — Test before DNS changes, then switch

Add an entry to your own hosts file pointing the domain at the new server so you alone can preview it while the cPanel host is still live for everyone else. Full steps are in previewing a site with your hosts file. Once every page, form and login checks out, lower the DNS TTL if it is not already low, then switch the nameservers or A record.

Do not cancel the cPanel account on switch day

DNS changes reach different networks at different speeds. Keep the old account active for at least a week after switching so visitors whose resolvers have not caught up yet are still served correctly, and so you have a fallback if anything unexpected turns up.

Rebuilding email and cron jobs

Recreate every mailbox and forwarder from your step 3 list on the new host before DNS switches, since incoming mail moves the moment the domain's mail records change. Recreate cron jobs from the same list once the site is live on the new server.

We can take this off your hands

Website migration away from a cPanel host is included free with our hosting plans. Send us your current cPanel login details and we will export, copy and test the site, then tell you when it is ready to switch.

Related reading