Skip to content
WordPress and WooCommerce4 min read

How to move a WordPress site to a new host

Short answer

To move WordPress, copy the files and database from the old host, create a new database and import the copy into it, upload the files, then update the connection details in wp-config.php. Test the site on the new host before changing nameservers, and keep the old hosting until DNS propagation is complete.

ArabyHost teamLast updated: ShareWhatsAppXLinkedIn
Contents
  1. Before you start
  2. Pick a migration method
  3. Manual migration steps
  4. Troubleshooting
  5. On ArabyHost

Moving WordPress means moving two things, the files and the database, and then pointing the domain at the new server. The classic mistake is switching nameservers first and uploading the site afterwards, which leaves it down for hours. The right order: copy, upload, test, then point the domain.

Before you start

  • Access to the old host: cPanel, or FTP plus phpMyAdmin.
  • A new hosting account with the domain added.
  • Access to your domain registrar to change nameservers.
  • A PHP version on the new host that your theme and plugins support.

Pick a migration method

Method When it fits Notes
Full cPanel account transfer Both hosts run cPanel Moves sites, email and databases together. See cPanel to cPanel migration
Migration plugin Small or medium sites All-in-One WP Migration, Duplicator or Migrate Guru. Some limit file size in their free versions
Manual move Any case, especially large sites Most control; the steps below

Manual migration steps

1. Lower the TTL in advance

If your DNS is managed somewhere other than the old host, lower the A record’s TTL a day before the move so the later change spreads quickly.

2. Back up the old site

Compress public_html into a ZIP and download it, and export the database from phpMyAdmin as SQL. Details are in WordPress backup and restore. Note the $table_prefix value in the old wp-config.php.

3. Create a new database

In the new cPanel, open MySQL Databases:

  1. Under Create New Database, enter a name such as wp and click Create Database.
  2. Under Add New User, create a user with a strong password.
  3. Under Add User To Database, choose the user and database, tick ALL PRIVILEGES and click Make Changes.

cPanel prefixes names with your account name, giving something like cpuser_wp. Use the full names.

4. Upload the files

Open File Manager, go to the domain’s document root (usually public_html), Upload the archive and Extract it. Turn on Show Hidden Files under Settings and confirm .htaccess is there.

5. Import the database

Open phpMyAdmin, select the new database, go to Import, choose the SQL file and click Import. For large files use a gzip-compressed dump.

6. Update wp-config.php

Open wp-config.php in File Manager with Edit and update:

define( 'DB_NAME', 'cpuser_wp' );
define( 'DB_USER', 'cpuser_wpuser' );
define( 'DB_PASSWORD', 'your-new-password' );
define( 'DB_HOST', 'localhost' );
$table_prefix = 'wp_';

$table_prefix must match the table prefix in the imported database.

7. Test before touching DNS

Edit the hosts file on your computer so the domain opens from the new server for you only. Add a line with the new server’s IP:

203.0.113.10  example.com www.example.com

On Windows the file is C:\Windows\System32\drivers\etc\hosts; on macOS and Linux it’s /etc/hosts. Check key pages and the dashboard, then remove the line. A certificate warning is normal at this stage, because SSL is usually issued after the domain points to the new server.

8. If the domain name changes

Replace the old URL with the new one in the database using a plugin such as Better Search Replace, or WP-CLI if you have it:

wp search-replace 'https://old-domain.com' 'https://new-domain.com' --skip-columns=guid --dry-run

Don’t do this with a raw SQL REPLACE: WordPress stores some settings as serialized data, which breaks when string lengths change by hand.

9. Point the domain to the new host

Change the nameservers at your registrar to the new host’s (see change nameservers), or change just the A record if DNS lives elsewhere. Track propagation with the DNS lookup tool.

10. After propagation

  • Confirm SSL has been issued and the site loads over HTTPS.
  • Move email if it was hosted with the old provider (see migrate email to a new host).
  • Recreate cron jobs, save permalinks, and purge caches.
  • Keep the old hosting running for a few days before cancelling, as a fallback.

Troubleshooting

  • “Error establishing a database connection”: the database name, user or password in wp-config.php is wrong, or the user isn’t added to the database. See error establishing a database connection.
  • White screen or critical error: a plugin or theme doesn’t work with the new PHP version. Turn on debugging briefly to see the cause, then update the plugin or change the version.
  • ERR_TOO_MANY_REDIRECTS: siteurl and home in wp_options don’t match the real URL, or an SSL setting clashes with Cloudflare. See ERR_TOO_MANY_REDIRECTS.
  • Posts return 404 but the home page works: .htaccess didn’t come across. Save permalinks again.
  • Garbled characters instead of Arabic: the database was exported with a different encoding. Export again as utf8mb4.

On ArabyHost

ArabyHost offers free migration help if you’d rather not move the site yourself. Every account runs cPanel, so any of the methods above works. A free SSL certificate is issued automatically once the domain points to ns1.arabicode.com and ns2.arabicode.com, and daily JetBackup backups start from day one. Hosting supports PHP 8.1 to 8.3, so if your site runs on an older version, update the theme and plugins before you move.

FAQ

Will my site go down during the move?

Not if you follow the right order: copy the site and test it on the new host first, then change nameservers. During propagation some visitors see the old copy and some the new one, and both work.

Will I lose Google rankings after changing hosts?

No, as long as the domain and URLs stay the same and the site runs without errors. Changing hosts doesn't change page addresses; changing the domain itself is what needs 301 redirects and a Search Console update.

What about email on my domain?

If your email is hosted with the old provider, create the same mailboxes on the new host and move the messages before switching nameservers, because the MX records change with them.

Useful? Share it with someone who needs it:WhatsAppXLinkedIn

Read next

Ready to put your idea online?

Fast, isolated hosting, support that understands you, and an AI assistant that fixes problems with you.