How to Configure a WordPress Website After its Migration

Every time you are fed up of your web hosting partner, you may think of migrating your WordPress website to a new hosting provider.

Looking for better options is evident. Nowadays, tons of reputed web hosting companies are offering some great incentives to host your site.

You may get a free website migration assistance, but sometimes, you need to do it yourself. If you transfer your website from one folder to another, root directory to a subfolder, subfolder to the root directory, you need to accomplish the task yourself.

Most of the people complain to receive "Error Establishing a Database Connection" after the migration. Have you ever thought to learn to troubleshoot?

While managing a WordPress site, you need to know what it's like to transfer its installation from one location to another.

In this tutorial, I am going to mention a few things, which are necessary to fix after moving the data.

Check the Database Credentials

Whenever you migrate your website from one place to another, you also need to relocate the database.

Especially, when you change the web hosting server, you need to create a new database, with new credentials, it means your old website can't connect with your new database until you match those details.

And it's one of the most significant issues people face. It's important to update the settings from the wp-config.php file; I hope you know how to edit it.

Let me show you the steps.

Step 1:

Open cPanel and look for the file manager, it's where your website's data is available; I am sure, you have opened it so many times.

How to Configure a WordPress Website After its Migration

As I always say, you may fret when not finding the exact cPanel layout. Well, every company uses a different cPanel template, so don't worry.

Search for the file manager icon and open it.

Step 2:

Make sure you're in the root directory. By default, when you open the file manager, you see the home directory.

How to Configure a WordPress Website After its Migration

Click on the public_html link from the left-hand sidebar. You can see tons of WordPress core files and folders. Search for wp-config.php and right-click to edit.

Step 3:

A popup appears to authenticate, click Edit.

How to Configure a WordPress Website After its Migration

Step 4:

Check the database credentials.

  • Database Name
  • Database Username
  • Database Password
  • Database Host

As I have discussed earlier, you need to fill the credentials of your new database. Click Save Changes once you update the details.

Now, you can see no error related to the database connection.

Update the Website URLs

If you have changed the WordPress installation folder or directory, you need to update your website's address; there are different ways to accomplish this.

You can use the wp-config.php file. Let me show you the example.


NOTE: If you have SSL enabled, use HTTPS. Don't forget to replace the URL with your website.

If you can log in to your WordPress admin panel, you can update the site URL by navigating to Settings>>General. But in most of the cases, you can't log in until you fix everything.

How to Configure a WordPress Website After its Migration

So, it's better to use cPanel.

You Should Check the Images

It's possible that your images may not appear. Instead, you see broken links. In most of the cases, the problem doesn't occur, but when you change your domain name during migration, you may in need to update the image links too.

If you search the web, many people may suggest you update the site's URL, but the interlinks don't get fixed, it requires you to update the URL for all the blog posts.

You require to go to phpMyAdmin>>Open the database>>select wp_posts>>open SQL and run the query.

How to Configure a WordPress Website After its Migration

UPDATE wp_posts SET post_content=(REPLACE (post_content, '',''));

Note: Don't forget to change the URLs.

It's important to note that you need to do such a thing only if you change the domain and see broken images in your blog posts. Otherwise, you don't need it.

Check the Interlinks of Your Blog Posts

Along with your images, you need to check if your interlinks are pointing to correct pages. When you change the domain name, you might need a plugin to set a redirection.

Note: It's not necessary that you face such a problem, confirm it and then think about doing something about it.

You have to use the Velvet Blues Update URLs plugin, it offers two fields to redirect all of your interlinks posts to your new URL.


Whenever you think about migrating your website, make sure you understand the perfect scenario. If you change the server, you need to take care of the database.

But if you are making any other complicated step, you require to do some research before making any changes. Changing the domain name requires the supervision.

Check out these top 3 WordPress hosting services:

Was this article helpful?