Paramclasses Academy - Blog

Tutorials Details

←
Post 37 of 40
→

How to Migrate a WordPress Website to a New Hosting Server ?

How to Migrate a WordPress Website to a New Hosting Server ?

November 17, 2026

1. Introduction

WordPress migration is the process of transferring an existing WordPress website from one hosting server to another without losing its content, design, database, users, media files, or functionality.

For example, suppose your website is currently hosted on Hostinger and you want to move it to another hosting provider. You need to transfer the website files and database, configure the new server, test the website, and finally point your domain to the new hosting server.

A successful migration should preserve:

  • Pages, posts, comments, and categories.

  • Themes, plugins, and custom code.

  • Images, videos, and other media files.

  • User accounts and website settings.

  • Permalinks and internal links.

  • Forms, checkout functionality, and other integrations.

Important: A WordPress website consists of two essential parts:

  1. Website Files: WordPress core files, themes, plugins, uploads, and configuration files.

  2. Database: Website content, settings, users, comments, menus, and other stored information.

Both parts must be transferred correctly.

2. Why Do We Need WordPress Migration?

There are several reasons to migrate a WordPress website.

2.1 Better Hosting Performance

A website may become slow when its current hosting server cannot handle its traffic or resource requirements.

Moving to a better server can improve loading performance and reliability.

2.2 Better Hosting Features

A new hosting provider may offer:

  • Better server resources.

  • Improved security features.

  • Automatic backups.

  • Better technical support.

  • Updated PHP and database versions.

2.3 Domain or Server Changes

Sometimes a developer needs to move a website from a temporary development domain to a production domain or transfer it to a different server.

2.4 Business Requirements

An organization may need to move its website to a hosting environment that supports its growing business requirements.

3. Understand the WordPress Migration Process

Before starting, understand the complete migration workflow.

  1. Create a complete backup of the existing website.

  2. Download website files from the old hosting server.

  3. Export the WordPress database.

  4. Create a new database on the destination server.

  5. Upload website files to the new hosting server.

  6. Import the old database into the new database.

  7. Update database credentials in wp-config.php.

  8. Update URLs if the domain or website address has changed.

  9. Test the migrated website.

  10. Update domain DNS records when ready.

  11. Configure SSL and perform final checks.

4. Pre-Migration Requirements

Before migrating a live website, collect the following information.

4.1 Old Hosting Access

You need access to:

  • Hosting control panel.

  • File Manager or FTP/SFTP.

  • phpMyAdmin.

  • Existing WordPress dashboard.

4.2 New Hosting Access

You need:

  • New hosting account.

  • File Manager or FTP/SFTP credentials.

  • Database creation access.

  • phpMyAdmin access.

  • Domain configuration access.

4.3 Important Website Information

Record these details before starting:

Information Example
Existing domain https://oldsite.com
New domain https://newsite.com
Old database name old_wp_db
New database name new_wp_db
Database username new_wp_user
Database host localhost
WordPress directory public_html

 

These are illustrative values. Use the actual credentials provided by your hosting company.

4.4 Create a Complete Backup

Always create a backup before making changes.

You should have:

  • A complete copy of the WordPress files.

  • A database export in SQL format.

  • A copy of wp-config.php.

  • A record of the existing DNS configuration.

  • A copy of important email-related DNS records if your domain also handles email.

Keep the backup somewhere outside the hosting account being migrated.

Important: Do not delete the old hosting account immediately after migration.

5. Method 1: Manual WordPress Migration

Manual migration is useful for developers because it explains how WordPress files and databases work.

We will use a cPanel-style hosting environment for this practical example. The names of options may differ between hosting providers.

Step 1: Download WordPress Website Files

First, log in to your old hosting account.

  1. Open cPanel.

  2. Navigate to File Manager.

  3. Open the website's document root, commonly public_html.

  4. Select the WordPress website files.

  5. Compress them into a ZIP archive.

  6. Download the ZIP archive to your computer.

Your WordPress directory generally contains:

public_html/
│
├── wp-admin/
├── wp-content/
├── wp-includes/
│
├── .htaccess
├── index.php
├── wp-config.php
├── wp-login.php
└── wp-settings.php

Important: Include hidden files such as .htaccess. In File Manager, enable the option to show hidden files if necessary.

The wp-content directory contains your themes, plugins, and uploaded media files.

Step 2: Export the WordPress Database

Now export the database from the old hosting server.

  1. Open cPanel.

  2. Select phpMyAdmin.

  3. Select the database used by your WordPress website.

  4. Click the Export tab.

  5. Select Quick export.

  6. Choose SQL format.

  7. Click Export.

A database backup file will be downloaded.

Example:

wordpress_backup.sql

This file contains the database structure and stored data.

Important: Confirm that you selected the correct database. Check the DB_NAME value in the existing wp-config.php file if you are unsure.

Step 3: Create a New Database on the Destination Server

Now log in to your new hosting account.

  1. Open cPanel.

  2. Navigate to MySQL Databases or MySQL Database Wizard.

  3. Create a new database.

  4. Create a database user.

  5. Assign the user to the database.

  6. Grant the required privileges, normally All Privileges for a standard WordPress installation.

Example:

Database Name: new_wp_db
Username: new_wp_user
Password: YourStrongPassword
Database Host: localhost

Some hosting providers automatically add an account prefix to database names and usernames.

Use the complete database name and username displayed by your hosting control panel.

Step 4: Upload Website Files to the New Server

Now upload the downloaded WordPress archive.

  1. Open File Manager on the new hosting server.

  2. Open the correct document root.

  3. Upload the ZIP archive.

  4. Extract the archive.

  5. Confirm that wp-admin, wp-content, and wp-includes are in the correct document root.

For example:

public_html/
│
├── wp-admin/
├── wp-content/
├── wp-includes/
├── index.php
└── wp-config.php

Avoid accidentally extracting the website into an extra nested folder such as:

public_html/wordpress/wordpress/

The files must be located in the directory from which the domain serves the website.

Step 5: Import the Old Database

Open phpMyAdmin on the new hosting server.

  1. Select the newly created database.

  2. Click Import.

  3. Choose the downloaded wordpress_backup.sql file.

  4. Confirm the format is SQL.

  5. Start the import.

  6. Wait for the success message.

After importing, check that WordPress tables are visible.

Examples:

wp_posts
wp_users
wp_options
wp_comments
wp_postmeta
wp_terms

The table prefix may be different. It is not always wp_.

Step 6: Update the wp-config.php File

The wp-config.php file contains important WordPress configuration details, including database connection credentials.

Open the new server's wp-config.php file.

Find the database configuration:

define( 'DB_NAME', 'old_database_name' );

define( 'DB_USER', 'old_database_user' );

define( 'DB_PASSWORD', 'old_database_password' );

define( 'DB_HOST', 'localhost' );

Replace the old values with the new database credentials:

define( 'DB_NAME', 'new_wp_db' );

define( 'DB_USER', 'new_wp_user' );

define( 'DB_PASSWORD', 'YourStrongPassword' );

define( 'DB_HOST', 'localhost' );

Save the file.

The database host may not always be localhost. Use the database host supplied by your hosting provider.

Also check the table prefix:

$table_prefix = 'wp_';

It must match the prefix of the imported database tables.

For example, if the imported tables start with site_, the configuration should use:

$table_prefix = 'site_';

Do not change the prefix unnecessarily.

Step 7: Update Website URLs When Required

There are two different migration situations.

Situation A: Same Domain, New Hosting

Example:

Old hosting: https://example.com
New hosting: https://example.com

If the domain and website URL remain unchanged, you normally do not need to replace the old domain throughout the database.

Situation B: Different Domain

Example:

Old domain: https://oldsite.com
New domain: https://newsite.com

In this situation, the database may still contain the old website address.

You must update the stored URLs safely.

One recommended method is WP-CLI.

First, create another database backup. Then run a dry-run command from the WordPress installation directory:

wp search-replace 'https://oldsite.com' 'https://newsite.com' --all-tables-with-prefix --skip-columns=guid --dry-run

Review the reported changes.

If the results are correct, run the command again without --dry-run:

wp search-replace 'https://oldsite.com' 'https://newsite.com' --all-tables-with-prefix --skip-columns=guid

This method is preferable to blindly replacing text in SQL because WordPress themes and plugins can store serialized PHP data.

The --skip-columns=guid option helps preserve GUID values, which should generally not be changed during a domain migration.

If WP-CLI is unavailable, use a reputable migration or search-and-replace tool that supports serialized data. Do not run a blanket SQL REPLACE() operation across every database field.

Step 8: Verify WordPress Site URL Settings

After migration, verify the WordPress Address and Site Address.

If you can access the WordPress dashboard:

  1. Open Settings.

  2. Select General.

  3. Check WordPress Address (URL).

  4. Check Site Address (URL).

  5. Confirm that both contain the intended website address.

If WP-CLI is available, you can inspect the values:

wp option get home

wp option get siteurl

To update them when required:

wp option update home 'https://newsite.com'

wp option update siteurl 'https://newsite.com'

Use the correct URL and path for your installation. The two values are often identical, but they can differ in some configurations.

Step 9: Test the Website Before Changing DNS

Do not immediately point the live domain to the new server.

First, test the new copy using a temporary hosting URL, staging domain, or a controlled local hosts-file override.

A hosts-file override lets your computer resolve the domain to the new server's IP address while other visitors continue reaching the old server.

Test:

  • Homepage.

  • WordPress login.

  • Admin dashboard.

  • Important pages and posts.

  • Images and media.

  • Menus and internal links.

  • Contact forms.

  • Search functionality.

  • Plugins and theme features.

For an e-commerce website, also test product pages, cart, checkout, payment configuration, and order-related workflows using a safe test setup.

6. Method 2: WordPress Migration Using a Plugin

Manual migration is not the only option. Migration plugins can package and transfer website files and database information.

Examples include:

  • Duplicator.

  • All-in-One WP Migration.

  • Migrate Guru.

The exact workflow, archive limits, hosting compatibility, and paid features depend on the plugin version and provider.

General Plugin Migration Workflow

  1. Install a migration plugin on the old website.

  2. Open its migration or export section.

  3. Generate a complete website package or export file.

  4. Download the generated files.

  5. Prepare the destination hosting environment.

  6. Upload or import the migration package using the plugin's documented process.

  7. Follow its installation or restoration instructions.

  8. Verify database and URL configuration.

  9. Test the migrated website.

Important: Do not assume every plugin can import an unlimited website archive on every hosting plan. Check upload limits, PHP limits, disk space, and plugin compatibility first.

For important production websites, keep an independent backup even when using a migration plugin.

7. Method 3: WordPress Migration Using WP-CLI

WP-CLI is a command-line interface for managing WordPress installations.

It is useful for developers who have SSH access and are comfortable working in a terminal.

Step 1: Check WP-CLI

wp --info

Step 2: Check WordPress Installation

wp core version

Step 3: Check Database Connection

wp db check

Step 4: Export the Database

wp db export wordpress_backup.sql

Step 5: Import the Database on the New Server

After configuring the new database connection in wp-config.php and uploading the SQL file:

wp db import wordpress_backup.sql

Step 6: Replace the Domain Safely

Preview the changes:

wp search-replace 'https://oldsite.com' 'https://newsite.com' --all-tables-with-prefix --skip-columns=guid --dry-run

Apply the changes after reviewing the preview:

wp search-replace 'https://oldsite.com' 'https://newsite.com' --all-tables-with-prefix --skip-columns=guid

Step 7: Clear WordPress Cache

wp cache flush

WP-CLI commands must be executed in the correct WordPress installation directory, with the appropriate database configuration and permissions.

8. Domain DNS Configuration After Migration

DNS configuration directs visitors to the server hosting your website.

After the new website has been tested successfully, update the domain's DNS records according to your hosting provider's instructions.

8.1 Understand the A Record

An A record maps a domain name to an IPv4 address.

Example:

Type: A
Name: @
Value: 192.0.2.10

The IP address above is an example, not a real hosting destination.

8.2 Understand the WWW Record

The www hostname may use a CNAME record pointing to the root domain, or an A record pointing to the new server, depending on the DNS setup.

Example:

Type: CNAME
Name: www
Value: example.com

Follow the actual DNS instructions supplied by your host.

8.3 Update DNS Records

  1. Log in to your domain registrar or DNS provider.

  2. Open DNS Management.

  3. Identify the existing website records.

  4. Update the relevant A, AAAA, or CNAME records as instructed.

  5. Save the changes.

  6. Monitor DNS resolution.

Do not delete unrelated DNS records without understanding their purpose.

If your domain uses email, preserve its MX, SPF, DKIM, and DMARC records. Changing nameservers can affect the entire DNS zone, including email services.

8.4 Understand DNS Propagation

DNS changes do not necessarily become visible everywhere immediately.

The time depends on record TTLs, DNS caching, and provider behavior.

Keep the old hosting account active while DNS changes are taking effect.

9. Configure SSL Certificate on the New Server

After the domain points to the new server, configure a valid SSL certificate.

A valid SSL certificate enables HTTPS access.

Example:

http://example.com

should ultimately redirect to:

https://example.com

Recommended steps:

  1. Open the new hosting control panel.

  2. Locate SSL/TLS or the provider's SSL management tool.

  3. Install or activate a certificate for the domain and required hostnames.

  4. Confirm that the certificate is valid.

  5. Verify that the website loads through HTTPS.

  6. Configure HTTPS redirects only after the certificate works.

Check for mixed-content warnings if images, scripts, or stylesheets still load through HTTP.

10. Final Testing Checklist

After migration, test the website carefully.

Website Frontend

  • Homepage loads correctly.

  • All important pages open.

  • Blog posts display correctly.

  • Images and media files load.

  • Navigation menus work.

  • Internal links point to the correct location.

  • Search functionality works.

  • No unexpected 404 errors appear.

WordPress Dashboard

  • /wp-admin opens correctly.

  • Administrator login works.

  • Pages and posts are available.

  • Media Library displays files.

  • Themes and plugins are active.

  • Permalink settings work.

Technical Checks

  • Database connection works.

  • PHP version is compatible.

  • SSL certificate is valid.

  • No mixed-content warnings remain.

  • Forms submit successfully.

  • Scheduled tasks work.

  • Cache and CDN settings are correct.

  • Backups are configured on the new host.

E-commerce Checks

For WooCommerce websites:

  • Product pages work.

  • Product images load.

  • Cart works.

  • Checkout works in a safe test.

  • Payment gateway configuration is correct.

  • Shipping and tax settings are preserved.

  • Existing orders and customer data are present.

For a live store, plan how to handle new orders during the final migration. A database export taken before new orders arrive will not include those later orders. Use a maintenance window, write freeze, or a carefully planned final database synchronization to avoid losing live data.

11. Common WordPress Migration Errors and Solutions

Error 1: Error Establishing a Database Connection

Possible reasons:

  • Incorrect database name.

  • Incorrect database username.

  • Incorrect password.

  • Wrong database host.

  • Database user does not have the required privileges.

Solution:

Check these values in wp-config.php:

define( 'DB_NAME', 'new_wp_db' );

define( 'DB_USER', 'new_wp_user' );

define( 'DB_PASSWORD', 'YourStrongPassword' );

define( 'DB_HOST', 'localhost' );

Confirm the actual values with your hosting provider.

Error 2: 404 Error on WordPress Pages

Possible reason:

The permalink rewrite configuration may not be working correctly on the new server.

Solution:

  1. Log in to WordPress Dashboard.

  2. Open Settings.

  3. Select Permalinks.

  4. Confirm your preferred permalink structure.

  5. Click Save Changes.

Also check that the web server rewrite configuration is supported.

Error 3: Images Are Not Displaying

Possible reasons:

  • wp-content/uploads was not transferred.

  • Image URLs still reference the old domain.

  • File permissions are incorrect.

  • The media directory is in the wrong location.

Solution:

Verify the uploads directory, inspect image URLs, and run a safe URL replacement if needed.

Error 4: White Screen or HTTP 500 Error

Possible reasons:

  • Incompatible PHP version.

  • Plugin conflict.

  • Theme error.

  • Incorrect file permissions.

  • PHP memory or execution limits.

Solution:

Check hosting error logs, verify PHP compatibility, and temporarily disable problematic plugins if necessary. Avoid exposing debugging errors publicly on a live website.

Error 5: Website Redirects to the Old Domain

Possible reason:

Old domain values may remain in the database, wp-config.php, or server redirect rules.

Solution:

Check:

  • WordPress Address and Site Address.

  • WP-CLI search-and-replace results.

  • Hard-coded URLs in theme or plugin settings.

  • Redirect rules in .htaccess or the hosting panel.

Error 6: SSL or Mixed Content Warning

Possible reason:

The new server does not have a valid certificate, or some resources still load over HTTP.

Solution:

Install and verify SSL, then safely update remaining HTTP resource URLs.

12. Important Best Practices for WordPress Migration

  1. Always back up both website files and the database.

  2. Test the migrated website before changing live DNS.

  3. Keep the old hosting account active until the new website is verified.

  4. Use SFTP or a secure hosting File Manager for file transfers.

  5. Never share database credentials publicly.

  6. Use a safe search-and-replace method that understands serialized data.

  7. Preserve the existing database table prefix unless there is a specific reason to change it.

  8. Do not modify GUID values during ordinary domain replacement.

  9. Check email-related DNS records before changing nameservers.

  10. Verify SSL, redirects, forms, and important integrations.

  11. Take a final backup after successful migration.

  12. Plan production migrations around website traffic and database activity.

13. Practical Assignment

Assignment: Migrate a WordPress Website to a New Hosting Server

Create a test WordPress website and migrate it to another hosting environment.

Task 1: Prepare the Website

  • Install WordPress on the source hosting.

  • Create at least three pages.

  • Publish two blog posts.

  • Upload five images.

  • Install a theme and two plugins.

Task 2: Create a Backup

  • Download all website files.

  • Export the database through phpMyAdmin.

  • Keep both backup files safely.

Task 3: Prepare Destination Hosting

  • Create a new database.

  • Create a database user.

  • Grant database privileges.

  • Upload the WordPress files.

Task 4: Restore the Website

  • Import the SQL database.

  • Update wp-config.php.

  • Check the table prefix.

  • Configure the site URL if required.

Task 5: Test the Migration

  • Open the homepage.

  • Log in to the WordPress dashboard.

  • Check pages, posts, and images.

  • Test plugins and menus.

  • Verify database connectivity.

Task 6: Complete DNS and SSL Setup

If you are using a test domain, configure its DNS to point to the destination hosting server. Activate SSL and verify HTTPS.

Expected Result: The migrated website should look and function like the original website, with its pages, posts, images, themes, plugins, and settings preserved.

14. Frequently Asked Questions

Q1. What is WordPress migration?

WordPress migration is the process of transferring a WordPress website's files and database from one hosting server or location to another.

Q2. Can I migrate WordPress without losing data?

Yes. A complete backup, correct database import, safe URL handling, and proper testing help prevent data loss.

Q3. Do I need to reinstall WordPress on the new hosting?

Not necessarily. In a manual migration, you normally transfer the existing WordPress files and database rather than creating a fresh installation.

Q4. Can I migrate WordPress without a plugin?

Yes. You can migrate WordPress manually using File Manager or SFTP, phpMyAdmin, and wp-config.php.

Q5. What is the role of wp-config.php during migration?

It stores important configuration values, including the database name, database username, password, database host, and table prefix.

Q6. Should I change DNS before or after migration?

Normally, transfer and test the website on the new server first. Change the live DNS records only after the destination website is ready.

Q7. How long does WordPress migration take?

It depends on website size, database size, network speed, hosting limits, and DNS caching. A small website may migrate relatively quickly, while a large website requires more preparation and testing.

Q8. Is a migration plugin better than manual migration?

Migration plugins can simplify the process for beginners. Manual migration provides more control and is useful for developers who want to understand the underlying process.

15. Conclusion

WordPress migration is an important skill for WordPress developers and website administrators.

A successful migration requires transferring both website files and the database, configuring the destination server, checking URLs, testing the website, and updating DNS only when the new environment is ready.

By practising manual migration, plugin-based migration, and WP-CLI commands, developers can confidently transfer WordPress websites between hosting providers while reducing downtime and data-loss risks.

Key Learning: Always remember that a WordPress migration involves two essential components: website files and the database. Both must be transferred and configured correctly.

←
Post 37 of 40
→