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 Domain1.com and then you transferred this domain to Domain2.com.
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 domain1.com 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.
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 www.mytechweb.ga and now I changed it to www.moh10ly.website
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 “http://www.moh10ly.website“
6. moh10ly@Ubunut-Mohammed:/var/www/html$ wp option update siteurl “http://www.moh10ly.website“
Now I tested my website and it’s working perfectly…