How to change domain name in WordPress
There are several ways to change domain name in WordPress website. We will be going to look at 2 methods. First is simple, second might look a bit complicated. By using the first method, we will change domain name simply by editing WordPress configuration file called “wp-config.php”.
Start by opening file “wp-config.php” for editing. It can be done by using file manager that is built in the control panel or usual FTP software. Then place the following lines somewhere in the file:
Then save and close the file to apply the changes. To check if the domain was changed, navigate to the new domain name by using web browser. If it shows the same website with new domain name, this means domain was changed successfully. If not, we might need to check for the mistake or possibly revert the changes.
Second method might look little complicated if we are not so familiar with editing databases. That’s where we will be going to change domain name for WordPress website. Before starting to do any changes in the database, it’s highly recommended to take a backup of the database and website files.
If backups are ready, we can start by opening database through phpMyAdmin. It’s usually being built in database client and major hosting service providers supply it in the server control panel. After opening database we should see it’s tables.
From the table list click on the one that says “wp_options” to see it’s records. From there we should see huge amount of lines that contains different information. Most of them saves values for WordPress options including domain name. To find which record is storing website domain name look for the line that says “siteurl” in the “option_name” column. Usually it’s the first record.
Next step is to edit this record by clicking on “Edit”. We will get another window which will allow us to edit the field under “option_value” column.
Simply change domain name to the new one and click “Go” button which will save the field and return to the previous page. From now on, WordPress should be using new domain name.