Soft2Hosting
How to Migrate a WordPress Website to Shared Hosting: Files, Database & DNS Checklist
Moving a WordPress site to a new cPanel hosting account is a five-part job: back up everything, copy the files, import the database, update the configuration, then test before you switch DNS. Done in that order, the old site keeps working until the new one is proven.
Before you start
- Access to the current site's files and database (cPanel, FTP or an export from your old host).
- Your new cPanel account from Soft2Hosting, with the domain added.
- A list of plugins, your PHP version and any custom
.htaccessrules. - A maintenance window, preferably a quiet time for your visitors.
The WordPress Advanced Administration Handbook's migration guide opens with the same first step: back up everything, meaning the WordPress directory, images, plugins and other site files, plus the database. Do not skip it, because it is the only way back.
Step 1: Back up the old site
Download the files, and export the database as a .sql file. If the old host also uses cPanel, its Backup Wizard can create a full or partial backup; its documentation says home directory backups are tar.gz archives and database backups are .sql files. Store the copies somewhere safe that is not the old server.
Step 2: Upload the files to the new account
In the new account's File Manager, upload your archive to the domain's document root, normally public_html, and use Extract. The File Manager documentation says it can extract zip, Gz and Bz2 archives, that the zip format works only if zip support is installed on the server, and that you cannot upload a whole folder, so upload an archive instead of dragging a directory. Turn on Show Hidden Files in Settings so you can see .htaccess.
Step 3: Create and import the database
- In cPanel, create a new MySQL database and a database user, and give the user all privileges on that database.
- Open phpMyAdmin, which the cPanel documentation describes as a third-party tool for manipulating MySQL or MariaDB databases, select the new database and use its Import tab to load your .sql file.
- Write down the database name, user, password and host, because the next step needs them.
Large imports can hit upload limits. If an import fails, split the file or ask support to import it.
Step 4: Update wp-config.php
The WordPress guide says that if the database name or user changes, you update wp-config.php with the new values. Edit these lines with File Manager's editor:
define( 'DB_NAME', 'cpaneluser_wpdb' );
define( 'DB_USER', 'cpaneluser_wpuser' );
define( 'DB_PASSWORD', 'the-password-you-created' );
define( 'DB_HOST', 'localhost' );On most shared hosting the host is localhost, but check your welcome email. The guide also says to confirm the database host entry if the database lives on another server.
If the domain is changing
If you are also changing the address, the guide says to change the two URL fields under Settings, General on the old site first, then download and export again. After importing, update URLs stored in the database with a tool such as WP-CLI's search-replace or the Better Search Replace plugin, because a plain find and replace can corrupt serialized data. The same page says never to change the contents of the GUID column.
wp search-replace 'http://old-domain.com' 'https://new-domain.com' --dry-run
wp search-replace 'http://old-domain.com' 'https://new-domain.com'Step 5: Test before switching DNS
You can view the new site before changing DNS by editing the hosts file on your computer so the domain points to the new server's IP address. Then check:
- Home page, a few posts, the contact form and search.
- The admin login and a draft post.
- Images, menus and widgets, and any old URLs that still point at the old site.
- Permalinks: the guide recommends backing up
.htaccess, copying custom rewrites or redirects across, and regenerating permalinks under Settings, Permalinks. - Stale transients, which can keep old URLs alive; the guide suggests deleting them from the migrated database copy because WordPress recreates them.
Remove the hosts entry when you are done.
Step 6: Switch DNS and watch
Lower the DNS TTL on the old records a day or two beforehand if your registrar lets you, so the change spreads faster. Then update the nameservers or A record to the new account. For a few days, keep the old hosting account active, because some visitors will still reach it. Do not change content on both sites during the transition, or you will have to reconcile comments and orders.
Email needs the same care. If your mail is hosted with the site, recreate mailboxes on the new account first, then move the mail records, and ask users to check their client settings.
Migration checklist
- Full backup of files and database stored off the old server.
- Files extracted in the right document root, hidden files visible.
- Database imported and wp-config.php updated.
- Site tested through a hosts file entry.
- SSL issued on the new account and the site forced to HTTPS.
- DNS switched, old account kept for a few days, backup taken on the new one.
If anything is unclear, Soft2Hosting's cPanel shared hosting includes site migration help; open a ticket with your old host's details before you start.