My HP

22nd December, 2015 | Moving Wordpress |

Changing your WordPress Domain

There may come a time when you need to change the URL of your WordPress website. In this article three different methods are explained how you can do this, depending on your circumstances. Please note that all three methods are not required - following one method will make the URL change.

WordPress Admin

If you have access to the WordPress admin section, log into this. From the left hand side menu, mouse hover over 'Settings' and choose 'General'.

alt text

In the general settings you can set the 'WordPress Address (URL)' and also the 'Site Address (URL)'. Make your changes carefully and remember that both addresses need to either start with http:// or https:// (if you have an SSL certificate), and that they do not need a trailing slash on the end of the address.

alt text

Once the changes have been made, scroll to the bottom of the settings page and select 'Save Changes'.

alt text

You should now find that your WordPress URL has been changed.

Edit the wp-config.php File

In your WordPress files on your server, there is a file named wp-config.php where you can set the WordPress URL. If you do not have access to your WordPress admin area, this is an alternative solution for you.

The first step is to log into your cPanel account. If you are unsure on how to do this, please view the following help article - 'How to log into cPanel'.

In cPanel, scroll down to the 'Files' section and choose 'File Manager'.

alt text

The file manager has access to all of the files on your server, including your WordPress files which is where we need to edit the wp-config.php file.

Using the left directory listing, open the 'public_html' folder and then click onto the folder that contains your WordPress installation.

alt text

Once in the WordPress folder, locate the wp-config.php file and mouse click onto it.

alt text

Choose 'Edit' from the top menu.

alt text

Open the file in the text editor by selecting 'Edit'.

alt text

You should now find that the wp-config.php opens. Scroll to the bottom of the wp-config.php file and add:

define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

Take note to change the example.com shown with your WordPress URL. Remember the URL must have http:// or https:// (if you have an SSL certificate), and no trailing slash on the end.

Select 'Save Changes' to complete the file edit process.

alt text

You should now find that your WordPress URL has been changed.

Update the WordPress Database

The WordPress URL is set in the WordPress database which is where it can also be changed from. Please note making incorrect changes in the database can cause signficant problems, so please be sure to double check the changes that you are doing.

Log into your cPanel account. If you are unsure on how to do this, please view the following help article - 'How to log into cPanel'.

In cPanel, scroll down to the 'Databases' section and choose 'phpMyAdmin'.

alt text

From the left hand side menu, expand the option to see the databases on your account.

alt text

Select the WordPress database. This is typically prefixed with _wp.

alt text

Select the '_options' table.

alt text

You should note that the first two rows in the _options table includes WordPress URL in the option_value fields.

alt text

Tick both of these rows using the select box on the left hand side of the row.

alt text

Scrolling to the bottom of the page, select the 'Change' option.

alt text

You can now edit the rows. Be careful to replace the existing WordPress with your new required URL. Remember the URL must have http:// or https:// (if you have an SSL certificate), and no trailing slash on the end.

alt text

Once your changes have been made, scroll to the bottom and select the 'Go' option to save the data rows.

alt text

You should now find that your WordPress URL has been changed.


In this article, you should now understand how to change the WordPress URL either in the WordPress admin, by editing the WordPress config file, or by editing the appropriate record in the WordPress database.

Comments