Overview
A WordPress migration means moving your files, database, and configuration from one hosting environment to another. It’s one of the most common tasks in web hosting, and it’s also one of the most commonly done wrong. People either forget to export the database, update the wrong config file, or flip DNS before the new server is ready.
You’ll need this guide if you’re switching hosting providers, upgrading from shared hosting to a Managed WordPress Hosting plan, or moving a client site between accounts. The process is the same in all three cases.
This article covers two methods: a plugin-based migration (easier, good for most users) and a manual migration (more control, better for developers and larger sites). I’d recommend the manual method if your site is over 2 GB or if you’ve had issues with plugin-based tools timing out before.
Prerequisites
- Admin access to your current WordPress dashboard (or FTP/SFTP credentials if the dashboard is inaccessible)
- cPanel, Plesk, or SSH access to both your old and new hosting accounts
- A database created on the new server before you start (note the DB name, username, and password)
- FTP/SFTP client installed locally — FileZilla works fine
- Access to your domain registrar to update nameservers or DNS records
- Allow 24–48 hours for DNS propagation after cutover (plan your migration window accordingly)
Method 1: Plugin-Based Migration (Recommended for Most Users)
This method uses the free Duplicator plugin (version 1.5+) or All-in-One WP Migration. Both work well on sites under 512 MB. For larger sites, Duplicator Pro handles chunked uploads which avoids PHP timeout errors.
- Install and run Duplicator on the old site. In your WordPress dashboard, go to Plugins > Add New, search for “Duplicator”, install and activate it. Then go to Duplicator > Packages > Create New. Accept the defaults and click Build. When it finishes, download both the Installer file and the Archive zip.
-
Upload both files to the new server. Using FileZilla or cPanel’s File Manager, upload the installer (
installer.php) and the archive (*.zip) to the public web root on the new server. That’s typically/public_html/or/public_html/yourdomain.com/depending on your setup. - Create a database on the new server. In cPanel, go to MySQL Databases, create a new database, create a user, and assign full privileges. Write down all three values — you’ll enter them in the next step.
-
Run the installer. In your browser, visit
https://yournewdomain.com/installer.php. The Duplicator wizard will walk you through entering your new database credentials and finalising the migration. On the last step, it will updatewp-config.phpand run a search-replace on the database to swap old URLs for new ones.⚠ Warning: Don’t close the browser tab mid-install. If it times out, the database will be in a partial state and you’ll need to drop it and start again.
- Log into WordPress on the new server and confirm everything looks right before touching DNS.
Method 2: Manual Migration via SSH and cPanel
This is the cleaner approach for larger sites or anyone who wants full control. It’s also what I’d use when migrating to a VPS or dedicated server where you have shell access.
-
Export the database from the old server. SSH into the old server and run:
Copied to clipboard
mysqldump -u DB_USERNAME -p DB_NAME > wordpress_backup.sqlReplace
DB_USERNAMEandDB_NAMEwith your actual values fromwp-config.php. You’ll be prompted for the password. If you don’t have SSH, use phpMyAdmin: go to your database, click Export, choose Quick, format SQL, and click Go. -
Archive your WordPress files. Still on the old server via SSH:
Copied to clipboard
cd /public_html tar -czf ~/wordpress_files.tar.gz .This compresses your entire WordPress installation into a single file in your home directory. If you only have FTP access, download the files directly with FileZilla instead — it’s slower but works.
-
Transfer the archive and SQL file to the new server. You can use
scp:Copied to clipboardscp ~/wordpress_files.tar.gz ~/wordpress_backup.sql user@NEW_SERVER_IP:~/Or upload both files via FileZilla to the new server’s home directory.
-
Extract files on the new server. SSH into the new server:
Copied to clipboard
cd /public_html tar -xzf ~/wordpress_files.tar.gz -
Import the database. First create the new database in cPanel under MySQL Databases, then import:
Copied to clipboard
mysql -u NEW_DB_USERNAME -p NEW_DB_NAME < ~/wordpress_backup.sql -
Update wp-config.php. Open
/public_html/wp-config.phpin a text editor (nano works fine):Copied to clipboardnano /public_html/wp-config.phpUpdate these three lines to match your new database:
Copied to clipboarddefine( 'DB_NAME', 'new_database_name' ); define( 'DB_USER', 'new_db_username' ); define( 'DB_PASSWORD', 'new_db_password' );⚠ Warning: Leave
DB_HOSTaslocalhostunless your host has told you otherwise. Changing it unnecessarily will break the database connection. -
Run a search-replace to update URLs in the database. Old serialised data in WordPress can’t be updated with a plain SQL find-and-replace — it’ll corrupt the data. Use WP-CLI instead:
Copied to clipboard
wp search-replace 'https://oldsite.com' 'https://newsite.com' --all-tablesIf WP-CLI isn’t available, use the Search Replace DB script by Interconnect/it. Upload it temporarily, run it, then delete it immediately — leaving it accessible is a security risk.
📝 Note: This step is the one most people skip, and it’s why images and internal links break after migration. Don’t skip it.
-
Test the site using a hosts file override before changing DNS. On your local machine, add a temporary entry to
/etc/hosts(Linux/macOS) orC:WindowsSystem32driversetchosts(Windows):Copied to clipboardNEW_SERVER_IP yourdomain.com www.yourdomain.comThis routes your browser to the new server without affecting anyone else. Browse your site, test the checkout or login flow, check that images load. When you’re satisfied, remove the line and update your DNS.
- Update DNS. Log into your domain registrar and point your A record (or nameservers) to the new server. Propagation typically takes 1–4 hours but can take up to 48 hours globally.
Common Issues and Troubleshooting
White screen or “Error establishing a database connection”
Almost always a wrong value in wp-config.php. Double-check DB_NAME, DB_USER, and DB_PASSWORD. Also confirm the database user has been assigned to the database in cPanel — creating both separately isn’t enough, you have to link them under Add User to Database.
Images and links pointing to the old domain
You didn’t run the search-replace step, or it only partially completed. Run the WP-CLI command again or use the Search Replace DB script. Also check your theme’s customiser settings and any page builder data — some plugins store URLs in their own database tables that the standard search-replace misses.
Redirect loop after migration
Usually caused by mismatched siteurl and home values in the database, or a leftover .htaccess file from the old server with hardcoded rewrite rules. Try resetting .htaccess by going to Settings > Permalinks and clicking Save Changes — this regenerates the file. If that doesn’t fix it, check wp_options in phpMyAdmin and manually correct the siteurl and home rows.
File permissions errors or 403 Forbidden
Permissions sometimes get mangled during transfer. WordPress files should be 644 and directories should be 755. Fix them in bulk via SSH:
find /public_html -type f -exec chmod 644 {} ;
find /public_html -type d -exec chmod 755 {} ;
Never set files to 777 — that’s a security hole.
Migration plugin times out on large sites
Free migration plugins hit PHP’s max_execution_time limit (usually 30–60 seconds on shared hosting). Options: use the manual method above, upgrade to Duplicator Pro which uses chunked transfers, or temporarily increase max_execution_time in php.ini or via .htaccess with php_value max_execution_time 300. On Host & Tech’s Managed WordPress Hosting plans, we handle migrations for you so this isn’t something you’d run into.
FAQ
Frequently Asked Questions
Can I migrate WordPress without losing SEO rankings?
Yes, as long as your URLs stay the same and you don’t leave the old site live at the same domain simultaneously. Make sure the search-replace step updates all internal links correctly, and submit an updated sitemap in Google Search Console after the move. Rankings can dip slightly for a few days after a DNS change — that’s normal and usually recovers quickly.
How long does a WordPress migration take?
The actual file and database transfer usually takes 15–60 minutes depending on site size. The DNS cutover can take anywhere from 1 to 48 hours to propagate globally, though most users will see the new site within 1–4 hours. Plan your migration during low-traffic hours and keep the old hosting active until DNS has fully propagated.
Do I need to reinstall WordPress on the new server first?
No. If you’re doing a full migration, you’re bringing your own WordPress files and database. Installing WordPress fresh on the destination first will just give you files you’ll overwrite anyway. Create the database and upload your migrated files directly to the web root.
What happens to my emails when I migrate my website?
Email is separate from WordPress — migrating your site files and database doesn’t affect email unless you also change your MX records. If your email is hosted with your current provider, leave your MX records pointing at them until you’ve set up email on the new server. Changing nameservers (rather than just the A record) will move everything at once, including email, so be careful there.
Is it safe to use a migration plugin on a live site?
Yes, migration plugins read your files and database without modifying the original site. Your live site stays up during the process. The only risk is if the plugin crashes mid-way on the destination server, which can leave a broken database — that’s why you always migrate to the new server first and only cut over DNS after you’ve confirmed everything works.