How to Migrate a WordPress Site to Another Hosting (Complete Step-by-Step Guide)
Migrating a WordPress site to a new hosting provider can feel overwhelming, but with the right approach, it's a straightforward process that preserves every post, page, plugin, and database record. Whether you're upgrading to a faster server, switching providers for better pricing, or moving to a more powerful environment, this guide walks you through every step — from backing up your files to testing your live site on the new host.
Why Migrate Your WordPress Site?
There are many legitimate reasons to move a WordPress installation to a new hosting environment:
- Performance upgrades — Moving to NVMe-powered VPS Hosting dramatically reduces page load times compared to shared environments.
- Scalability — Your current host can't keep up with growing traffic.
- Cost efficiency — Better resources at a lower monthly price.
- Security improvements — Access to DDoS protection, firewalls, and isolated environments.
- Full server control — Root access lets you configure PHP, NGINX, Apache, and caching layers exactly as needed.
Whatever your reason, following a structured migration process ensures zero data loss and minimal downtime.
Before You Begin: Pre-Migration Checklist
Rushing into a migration without preparation is the most common cause of data loss and extended downtime. Complete these steps before touching a single file:
1. Choose Your New Hosting Provider
Select a hosting plan that matches your site's current and future needs. Consider:
- Storage type — NVMe SSD vs. traditional HDD
- RAM and CPU allocation
- PHP version support
- Control panel availability (cPanel, Plesk, DirectAdmin)
- Support quality and response time
If you're running a growing WordPress site, a VPS with cPanel gives you the flexibility of a dedicated environment with the familiarity of a graphical control panel — ideal for managing databases, files, and email accounts without command-line expertise.
2. Create a Complete Backup of Your WordPress Site
Never begin a migration without a verified, full backup. A complete WordPress backup consists of two components:
- All WordPress files (themes, plugins, uploads, core files, and configuration)
- The MySQL database (all posts, pages, settings, users, and metadata)
Both must be backed up and stored safely before proceeding.
Step 1: Back Up Your WordPress Files
Option A: Using an FTP Client (FileZilla)
- Download and install FileZilla (or any FTP/SFTP client of your choice).
- Connect to your current hosting server using your FTP credentials:
- Host: your server IP or domain
- Username: your FTP username
- Password: your FTP password
- Port:
21(FTP) or22(SFTP — recommended for security)
- Navigate to your WordPress root directory — this is typically
public_html/orwww/. - Select all files and folders, including hidden files (e.g.,
.htaccess). In FileZilla, enable hidden file visibility under Server → Force showing hidden files. - Download everything to a dedicated folder on your local computer.
Option B: Using Your Hosting Control Panel File Manager
- Log into your current hosting control panel (cPanel, Plesk, etc.).
- Open the File Manager.
- Navigate to
public_html/(or your WordPress root). - Select all files, compress them into a
.ziparchive. - Download the archive to your local machine.
> Pro tip: Verify the downloaded archive is complete and not corrupted before proceeding. An incomplete backup is as dangerous as no backup at all.
Step 2: Export Your WordPress Database
Your WordPress database contains everything that makes your site unique — all content, user accounts, settings, and plugin data. Exporting it correctly is critical.
Step 2.1: Access phpMyAdmin on Your Current Host
- Log into your current hosting control panel.
- Navigate to the Databases section and open phpMyAdmin.
- In the left sidebar, click on your WordPress database (the database name is listed in your
wp-config.phpfile underDB_NAME).
Step 2.2: Export the Database
- Click the Export tab at the top of the phpMyAdmin interface.
- Select the Quick export method for a standard, complete export.
- Ensure the format is set to SQL.
- Click Go — phpMyAdmin will download a
.sqlfile to your computer.
> Important: Keep this .sql file safe. It is the complete snapshot of your WordPress database and is irreplaceable without your original server.
Step 3: Upload Your WordPress Files to the New Host
With your files and database backed up locally, it's time to set up your new hosting environment.
Step 3.1: Connect to Your New Hosting Server
Use your FTP/SFTP client with the credentials provided by your new hosting provider. If you've chosen a VPS Hosting plan, you may also connect via SSH for faster file transfers using scp or rsync.
Using rsync over SSH (recommended for VPS users):
rsync -avz --progress /local/path/to/wordpress/ user@new-server-ip:/var/www/html/This method is significantly faster than FTP for large sites and preserves file permissions.
Step 3.2: Upload All WordPress Files
- Navigate to the root web directory on your new server (typically
public_html/or/var/www/html/). - Upload all files and folders from your local WordPress backup, including hidden files like
.htaccess. - Wait for the transfer to complete fully before proceeding.
Step 4: Create a New Database on the New Host
Step 4.1: Create the Database and User
- Log into your new hosting control panel.
- Navigate to MySQL Databases (or equivalent).
- Create a new database — choose a descriptive name (e.g.,
wp_newsite). - Create a new database user with a strong password.
- Assign the user to the database with All Privileges.
- Note down the database name, username, and password — you'll need these shortly.
Step 4.2: Import the Database via phpMyAdmin
- Open phpMyAdmin on your new hosting control panel.
- Select the newly created database from the left sidebar.
- Click the Import tab.
- Click Choose File and select the
.sqlfile you exported earlier. - Leave all settings at their defaults and click Go.
- Wait for the import to complete — you should see a success confirmation message.
> Note: For large databases (over 50MB), phpMyAdmin may time out. In this case, use the command line on a VPS:
> “`bash
> mysql -u new_database_user -p new_database_name < /path/to/backup.sql
> “`
Step 5: Update wp-config.php
The wp-config.php file is the bridge between your WordPress files and your database. After migrating to a new server, you must update it with your new database credentials.
Locate and Edit wp-config.php
- In your new server's root WordPress directory, find the file named
wp-config.php. - Open it in a text editor (Notepad++, VS Code, or via SSH with
nano). - Update the following lines with your new database details:
define( 'DB_NAME', 'new_database_name' );
define( 'DB_USER', 'new_database_user' );
define( 'DB_PASSWORD', 'new_database_password' );
define( 'DB_HOST', 'localhost' ); // Usually 'localhost' — confirm with your host- Save the file and upload it back to the server if you edited it locally.
> Security tip: While you have wp-config.php open, verify that your AUTH_KEY, SECURE_AUTH_KEY, and other secret keys are present. You can regenerate them using the WordPress Secret Key Generator.
Step 6: Update Domain DNS Settings
If you're keeping the same domain name but pointing it to a new server, you need to update your DNS records.
Step 6.1: Log Into Your Domain Registrar
Access the control panel where your domain is registered. If you haven't yet registered a domain or need to transfer one, Domain Registration through your hosting provider simplifies management by keeping everything in one place.
Step 6.2: Update Nameservers or A Records
You have two options:
Option A — Update Nameservers (recommended if switching hosting entirely):
- Replace the existing nameservers with those provided by your new hosting provider.
- Example:
ns1.newhost.comandns2.newhost.com
Option B — Update the A Record (if keeping your current DNS provider):
- Update the
Arecord for your domain (andwwwsubdomain) to point to your new server's IP address.
Step 6.3: Wait for DNS Propagation
DNS changes can take anywhere from a few minutes to 48 hours to fully propagate worldwide. During this window, some visitors may still see the old site. To test your new site before DNS propagates, use your system's hosts file to point the domain to the new IP locally.
On Linux/macOS:
sudo nano /etc/hosts
# Add: NEW_SERVER_IP yourdomain.com www.yourdomain.comOn Windows:
Edit C:WindowsSystem32driversetchosts as Administrator.
Step 7: Install and Configure an SSL Certificate
Once your domain is pointing to the new server, secure your site with HTTPS. A valid SSL certificate is essential for user trust, data security, and Google search rankings.
If your new hosting plan doesn't include a free SSL certificate, you can obtain one through SSL Certificates — available in Domain Validation, Organization Validation, and Extended Validation tiers to suit any site type.
For VPS users, you can also install a free Let's Encrypt certificate using Certbot:
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.comStep 8: Test Your Migrated WordPress Site
With DNS propagated and SSL configured, thoroughly test your site before announcing the migration is complete.
Essential Testing Checklist
| Test | What to Check |
|---|---|
| Homepage loads | Correct content, images, and layout |
| Internal links | All navigation links resolve correctly |
| Contact forms | Form submissions work and emails are delivered |
| Media files | Images and videos display without broken links |
| Admin login | WordPress dashboard accessible at /wp-admin/ |
| Plugins | All active plugins function correctly |
| SSL/HTTPS | Padlock icon visible; no mixed content warnings |
| Page speed | Run a GTmetrix or Google PageSpeed Insights test |
Fix Permalinks
After migration, WordPress permalink structures sometimes break. To refresh them:
- Log into your WordPress Admin Dashboard.
- Navigate to Settings → Permalinks.
- Click Save Changes (without changing anything) — this regenerates the
.htaccessrewrite rules.
Step 9: Troubleshooting Common Migration Issues
Even with careful preparation, issues can arise. Here are the most common problems and their solutions:
Error: "Error Establishing a Database Connection"
Cause: Incorrect database credentials in wp-config.php.
Solution:
- Double-check
DB_NAME,DB_USER,DB_PASSWORD, andDB_HOSTinwp-config.php. - Confirm the database user has been granted full privileges on the database.
- On some hosts,
DB_HOSTmay not belocalhost— check your hosting control panel for the correct hostname.
Error: Broken Images or Missing Media Files
Cause: Media files weren't uploaded, or WordPress is referencing the old domain's URLs.
Solution:
- Verify all files in
wp-content/uploads/were transferred. - Use the Better Search Replace plugin to update old URLs in the database:
- Replace:
http://oldsite.com - With:
https://newsite.com
Error: White Screen of Death (WSOD)
Cause: PHP errors, incompatible plugins, or memory limits.
Solution:
- Enable WordPress debug mode in
wp-config.php:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );- Check
/wp-content/debug.logfor error details. - Temporarily deactivate all plugins by renaming the
pluginsfolder via FTP.
Error: 404 on All Pages Except Homepage
Cause: Permalink structure not regenerated after migration.
Solution: Go to Settings → Permalinks in WordPress admin and click Save Changes.
Error: Redirect Loop
Cause: SSL/HTTPS settings conflict, or siteurl/home values in the database point to the wrong URL.
Solution:
- Update
siteurlandhomein the WordPress database via phpMyAdmin:
UPDATE wp_options SET option_value = 'https://yournewdomain.com' WHERE option_name = 'siteurl';
UPDATE wp_options SET option_value = 'https://yournewdomain.com' WHERE option_name = 'home';Choosing the Right Hosting for Your WordPress Site
The success of your migration also depends heavily on the quality of your new hosting environment. Here's a quick guide to matching your site's needs to the right plan:
| Site Type | Recommended Hosting |
|---|---|
| Small blogs, personal sites | Shared Web Hosting |
| Growing business sites, WooCommerce | VPS Hosting |
| High-traffic, enterprise WordPress | Dedicated Servers |
| AI-powered or ML-integrated WordPress | GPU Hosting |
For most WordPress sites experiencing growth, a VPS is the sweet spot — offering dedicated resources, full root access, and the ability to fine-tune your PHP, NGINX, and caching configuration without the cost of a dedicated server.
Final Migration Checklist
Before you consider the migration complete, run through this final checklist:
- [ ] All WordPress files uploaded to the new server
- [ ] Database exported from old host and imported to new host
- [ ]
wp-config.phpupdated with new database credentials - [ ] DNS nameservers or A records updated
- [ ] SSL certificate installed and HTTPS working
- [ ] All pages, posts, and media files verified
- [ ] Contact forms and email functionality tested
- [ ] Permalinks refreshed in WordPress admin
- [ ] Old site kept active until DNS fully propagates
- [ ] Backup of the new site taken post-migration
Conclusion
Migrating a WordPress site to a new hosting provider is a manageable process when you follow a structured, step-by-step approach. The key pillars of a successful migration are: a complete backup before you start, careful database handling, accurate wp-config.php configuration, and thorough post-migration testing.
By moving to a high-performance hosting environment — whether that's a managed VPS, a cPanel-equipped server, or a dedicated machine — you're not just changing hosts. You're investing in faster load times, better security, and a more scalable foundation for your WordPress site's future growth.
Take your time with each step, verify your work at every stage, and your site will be live on its new home with minimal disruption to your visitors.
