How to transfer your WordPress blog to new domain ?

As a freelancer, I often need to transfer a WordPress blog. First, I design a blog on my server, then I add posts and content, and then I need to transfer the blog to a new domain. So, how do I transfer a blog from an old domain to a new domain?

Let us see :

Step 1: We have :

Old blog:
New location:

Copy all files from the old blog directory to your hard disk. Then, go to phpmyadmin and export the entire database to your hard disk. For example, wp1.sql is your exported file.

Step 2:
You must copy all data from your hard disk to the new blog.

Step 3: Go to your new hosting and domain’s Cpanel (or site panel). Creta new database and new user and add all roles :
Create mysql database in Cpanel

Create mysql user from Cpanel

Step 4 :
Go to the new site’s PhpMyAdmin and import the entire wp1.sql file from the old site. You have now created a new database.

Step 5:
In this step, we will edit the wp-config.php file in the new WordPress blog files.
Add username and password and database name in the wp_confip.php file.wp-config file edit

Now add in the wp-config file this code below these details :
define(‘WP_SITEURL’, ‘’);
define(‘WP_HOME’, ‘’);

Step 6 :
Now go to the new blog,, and log in to the WordPress site. After logging in, go to the plugins section and install the Search and Replace plugin.

Search for:
and replace with:

This plugin will replace all MySQL database words where you have your old blog name.

Here are detailed steps:

Step 1: Backup Files and Database

  • Backup Files: Ensure that you copy all files and folders from your old blog directory, including hidden files like

    which might not be visible by default.

  • Backup Database: When exporting the database via phpMyAdmin, consider using the “Custom” export method to include all tables and potentially drop existing tables on import, which helps prevent conflicts.

Step 2: Transfer Data to New Host

  • Transfer Files: Use an FTP client like FileZilla to upload the files from your hard disk to the root directory of your new domain.
  • Preserve File Structure: Ensure that the directory structure on your new host matches exactly that on your old host.

Step 3: Create a New Database

  • Database Creation: Create a new database via your hosting control panel. Note down the database name, username, and password.
  • Assign Privileges: Make sure the database user has all necessary privileges, which typically include SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, LOCK TABLES, and more.

Step 4: Import Database

  • Modify Import File: Before importing, you might need to edit the SQL file (wp1.sql) to include SQL commands to

    if not already present, and to


    the newly created database.

  • Import via phpMyAdmin: Upload and execute the import of your wp1.sql file in the phpMyAdmin of your new hosting.

Step 5: Update WordPress Configuration

  • Edit wp-config.php: This is crucial for connecting WordPress to the right database. Here’s a template for the code you might need:
    define(‘DB_NAME’, ‘your_new_db_name’);
    define(‘DB_USER’, ‘your_new_db_username’);
    define(‘DB_PASSWORD’, ‘your_new_db_password’);
    define(‘DB_HOST’, ‘localhost’); // Often ‘localhost’, but can vary
    define(‘WP_SITEURL’, ‘’);
    define(‘WP_HOME’, ‘’);

Step 6: Update URLs

  • Using Search and Replace Plugin: This step is vital for fixing broken links and references in the database. Ensure all instances are replaced correctly, and consider running the search and replace in the serialized data as well.

Additional Tips:

  • Test Before Going Live: You might want to set up a maintenance page or test the site thoroughly before updating the domain’s DNS settings.
  • Check Permalinks: After the migration, go to “Settings” > “Permalinks” in WordPress and click “Save Changes” to flush the rewrite rules.
  • Update Google Analytics and Webmaster Tools: Don’t forget to update these to reflect your new domain.
Daniel Smith

Daniel Smith

Daniel Smith is an experienced economist and financial analyst from Utah. He has been in finance for nearly two decades, having worked as a senior analyst for Wells Fargo Bank for 19 years. After leaving Wells Fargo Bank in 2014, Daniel began a career as a finance consultant, advising companies and individuals on economic policy, labor relations, and financial management. At, Daniel writes about personal finance topics, value estimation, budgeting strategies, retirement planning, and portfolio diversification. Read more on Daniel Smith's biography page. Contact Daniel:

Inflation Is Eating IRA/401(k) Savings! How to Protect Your IRA/401(k) in Bad Times?


Recent Posts