How to Migrate a WordPress Site to a New Hosting Step by Step

Migrating a WordPress site to a new hosting provider may seem like a complex task, but with the right approach, it can be done smoothly and without downtime. Whether you’re moving to a more reliable host, looking for better performance, or reducing costs, following a structured process will help ensure a successful transition.

This guide will walk you through the step-by-step process of migrating your WordPress site to a new hosting provider.

1. Back Up Your Website Files and Database

Before making any changes, it’s essential to create a full backup of your website. This ensures that you have a restore point in case anything goes wrong during the migration.

Backing Up Website Files

You can back up your website files using:

  • cPanel File Manager – Compress and download the WordPress root folder (public_html or www).
  • FTP Client (FileZilla, Cyberduck, or WinSCP) – Connect to your server and manually download all files.
  • Backup Plugins – Plugins like UpdraftPlus, Duplicator, or All-in-One WP Migration can automate the backup process.

Backing Up the Database

The WordPress database stores all posts, pages, comments, and settings. To back it up:

  1. Log into phpMyAdmin from your hosting control panel.
  2. Select your WordPress database.
  3. Click on the Export tab.
  4. Choose Quick export method and SQL format.
  5. Click Go and save the database file on your computer.

2. Set Up Your New Hosting Environment

After backing up your website, it’s time to prepare your new hosting account for migration.

Choosing the Right Hosting Plan

Ensure that your new hosting provider meets WordPress requirements, including:

  • PHP 7.4 or higher
  • MySQL 5.7 or higher
  • SSL support
  • Adequate storage and bandwidth

Creating a New Database

Most hosting providers offer cPanel or a similar control panel to manage databases. Follow these steps to create a new database:

  1. Log into cPanel.
  2. Open MySQL Databases.
  3. Click Create a New Database and name it appropriately.
  4. Create a new MySQL user and assign it to the database with All Privileges.
  5. Save the database name, username, and password for later use.

3. Upload Your Website Files and Database

Now that your new hosting environment is ready, you can transfer your website files and database.

Uploading Files

Use an FTP client or cPanel File Manager to upload your website files to the new server. If you backed up a compressed ZIP file, extract it in the public_html folder.

Importing the Database

  1. Log into phpMyAdmin on the new hosting account.
  2. Select the newly created database.
  3. Click Import.
  4. Upload the SQL file you exported earlier.
  5. Click Go to import the data.

4. Update wp-config.php and Point Your Domain to the New Host

Your WordPress site will not work on the new host until you update the configuration file and change domain settings.

Editing wp-config.php

  1. Open wp-config.php in a text editor.
  2. Locate the database connection settings: phpKopiujEdytujdefine('DB_NAME', 'your_database_name'); define('DB_USER', 'your_database_user'); define('DB_PASSWORD', 'your_database_password'); define('DB_HOST', 'localhost');
  3. Replace the placeholders with your new database credentials.
  4. Save and upload the updated file to your new hosting server.

Changing DNS Settings

Your domain is still pointing to the old host, so you need to update the DNS (Domain Name System) records to reflect your new hosting provider.

  1. Log into your domain registrar’s dashboard (e.g., GoDaddy, Namecheap, Cloudflare).
  2. Locate the DNS settings or Nameservers section.
  3. Replace the old nameservers with those provided by your new host.
  4. Save changes and wait for propagation (can take up to 48 hours).

5. Test and Troubleshoot Your Website

Once the DNS changes take effect, it’s time to test your website to ensure everything is working correctly.

Checking for Errors

  • Visit your website and check for broken links or missing images.
  • Test different pages, posts, and forms.
  • Ensure that plugins and themes are functioning properly.

Clearing Cache

If your website appears broken or outdated, try:

  • Clearing your browser cache.
  • Purging your WordPress caching plugin (if used).
  • Flushing the DNS cache using the command: shKopiujEdytujipconfig /flushdns # Windows sudo dscacheutil -flushcache # macOS

Fixing Common Issues

  • Database connection errors – Double-check the database credentials in wp-config.php.
  • Broken permalinks – Go to WordPress Settings > Permalinks and click “Save Changes” to refresh URLs.
  • White screen of death – Disable plugins by renaming the /wp-content/plugins/ folder via FTP.

Once everything is working correctly, your migration is complete.

Migrating a WordPress site to a new hosting provider may seem daunting, but following these structured steps ensures a smooth transition. Always back up your data, carefully update configuration files, and test your website before finalizing the process.

With the right preparation, you can move your site with minimal downtime and continue growing your online presence without interruptions.

Leave a Comment