How to configure WordPress to Work with the new domain?

So you have got a new domain address. Here are some methods to configure WordPress to work with the new domain address.

     I) By using phpMyAdmin

1. First, log into your cPanel.

2. Then, open the phpMyAdmin dashboard.

3. In the dashboard select your WordPress database name. Then go to the table_wp options.

4. Find out the site URL and home option. Then, change their values to the new domain.
    
   II) By using WordPress Admin Dashboard

1. First log into your WordPress dashboard.

2. In the Settings section click on General.

3. Enter your new domain under the WordPress Address(URL) and the Site address(URL). After all the changes are made, save the changes.

   III) By using WP-CLI over SSH

1. First, connect to your hosting server through SSH.

2. Then go to your WordPress installation folder. Execute the command given below:
wp db export​
This command will create a backup of your database into an SQL file.

3. Next, execute the following command:
wp search-replace 'http://olddomain.com' 'http://newdomain.com'​
Here the previous domain name is 'http://olddomain.com' and the new domain name is 'http://newdomain.com'. In your case, it will be different. Put the old and new addresses accordingly.

4. In the last step execute the command given below:
1 wp cache flush​
That's it. This is how you can configure WordPress to work with a new domain name.

Did you find this article useful?