Before you start
- File and database access on the old host — File Manager or SFTP, plus phpMyAdmin or SSH
- A hosting account on the new server
- Your DNS TTL lowered at least a day in advance
Step 1: Freeze changes and export the database
Pause publishing, and on a store, note the time — orders taken on the old server after this will not come across. Export the database from phpMyAdmin (select the database → Export → SQL) or over SSH.
wp db export site.sql # or mysqldump -u dbuser -p dbname > site.sqlStep 2: Copy every file
Download the whole WordPress directory, not just wp-content: wp-config.php and the hidden .htaccess file matter too. Compressing the directory into one archive in File Manager first makes the transfer much faster and less error-prone.
Step 3: Create the database on the new host
On cPanel, open MySQL Databases: create a database, create a user with a strong password, then add the user to the database with ALL PRIVILEGES. cPanel prefixes both names with the account username, so note the full names it shows.
Step 4: Import the database
Use phpMyAdmin's Import tab on the new database. If the file is larger than phpMyAdmin's upload limit, import over SSH instead.
mysql -u cpuser_wpuser -p cpuser_wp < site.sqlStep 5: Upload the files and update wp-config.php
Extract the archive into the document root, usually public_html. Then set the new database details. Leave $table_prefix exactly as it was on the old server — if it does not match the imported tables, WordPress shows its install screen as if the site were empty.
define( 'DB_NAME', 'cpuser_wp' ); define( 'DB_USER', 'cpuser_wpuser' ); define( 'DB_PASSWORD', 'the-password-you-set' ); define( 'DB_HOST', 'localhost' );Step 6: Test it before changing DNS
Point only your own computer at the new server with a hosts file entry, then browse the site, log in and submit a form. The file is /etc/hosts on macOS and Linux and C:\Windows\System32\drivers\etc\hosts on Windows.
192.0.2.10 yourdomain.com www.yourdomain.comStep 7: Switch DNS, then issue the certificate
Change the A record or nameservers, remove your hosts entry, and issue the SSL certificate once the domain resolves to the new server. Keep the old hosting account for a few days in case something was missed.
The mistake people make
Leaving the hidden .htaccess file behind. The homepage loads, so the move looks done, but every other page returns 404 until permalinks are rewritten — re-saving Settings → Permalinks recreates the file.
