How to change WordPress main URL to new one

Using WP-CLI (preferred):

Enter folder where your WordPress is installed:

[email protected] [~]# cd ~/public_html

Create backup of your database:

[email protected] [~/public_html]# wp db export

The following command won’t do any change because of –dry-run key specified but show you tables and amount of replacement

[email protected] [~/public_html]# wp search-replace ''
Read the rest