These are instructions that demonstrate how to change WordPress to match your replaced or changed Public domain. as this occurs in case if you are already using WordPress and have it published on let’s say and then you transferred this domain to

When you try to reach wordpress website from your new public domain. you might not reach it or wordpress might try to redirect you to your old instead.

In order to fix this, we’ll have to use a tool called wp-cli which fixes this configuration problem. to do so please open your SSH shell or get in your UBuntu server and do the following.

  1. sudo curl -O

2. From User@UbuntuServer:/var/www/html$ I will run the following command to make sure that the command is working

sudo php wp-cli.phar –info


3. I’ll move the file to a new path and location so I can access it from anywhere using only the command WP.

First I will give the required permissions

moh10ly@Ubunut-Mohammed:/var/www/html$ sudo chmod +x wp-cli.phar


Next I will move the file

sudo mv wp-cli.phar /usr//local/bin/wp


3. Check if the file is working properly after moving?


4. Final step is to change the domain of your wordpress site to a new domain.

My previous domain was and now I changed it to

So I only used two commands to change the domain name to the new on

5. moh10ly@Ubunut-Mohammed:/var/www/html$ wp option update home “


6. moh10ly@Ubunut-Mohammed:/var/www/html$ wp option update siteurl “


Now I tested my website and it’s working perfectly…

Leave a Reply

Your email address will not be published. Required fields are marked *