Categories: Linux

CHANGE WORDPRESS DOMAIN USING HTTP://WP-CLI.ORG/

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.

  1. sudo curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar

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…

http://wp-cli.org/

moh10ly

Recent Posts

Reset passwords for Active Directory Users

Reset and manage your Active Directory users' Passwords Active Directory is one of the most…

1 year ago

Finding Exchange Database hidden mailboxes. ​

Finding Exchange Database hidden mailboxes. Story:Maybe you have been in this situation before, trying to…

1 year ago

Setting up ADConnect and PTA (Password auth through) servers agents behind proxy

If you're using a Proxy server in your firewall or in your network and have…

1 year ago

Get Report of Active Directory Locked Accounts and Machine they logged in from

Story:I got some clients  that have reported some of their users being locked out and…

1 year ago

Checking and Providing Full and SendAs delegate access on O365 Exchange Online

Delegate Permissions This is a code that I have wrote recently to check if an…

1 year ago

Retrieving attachments from Exchange mailbox using python

Story: I got a request from a client who constantly gets CVs and have to…

2 years ago