Category: tutorials

How to change the URL of a WordPress website?

There are several reasons why you might need to change the address of a website. And this can be done in several ways.

In this article, we will answer these 2 questions: why and how!

Why do we need to change the URL?

There are several reasons why you may need to change the URL of a WordPress site.

  • If you no longer use a domain name for legal reasons
  • In the case of a company or brand name change, the domain name may need to be changed to accommodate this change
  • A technical constraint may lead to changing the URL of the company’s website, but this is a case of force majeure
  • Any change of URL has a strong impact in terms of search engine optimisation.

Note: On WordPress, there are 2 configurable addresses: the WordPress address (site URL) and the site address (we talk about the home page URL).

Prerequisites before changing the URL of a WordPress site

Warning: This operation is technical. It requires good expertise in WordPress technology and knowledge of system administration, especially if bugs or side effects appear during the change. We, therefore, recommend that you contact a professional to perform this type of work.

There are some necessary prerequisites before changing the URL of your WordPress site.

Make a complete backup of your website: You can never be too careful and changing your website URLs can be tricky. It involves making major changes to the site structure or database. A very small mistake can crash the site or trigger bugs. So it’s best to have a complete backup beforehand so you can go back in case of a problem.

Make sure you have access to the database and source code (via FTP) in case the change from the WordPress administration interface requires additional intervention.

A change of URL means a potential change of domain: you must therefore buy the destination domain name if it is not already the case. It is also necessary to think about “pointing” the new domain name to the website. To do this, you must contact the company where the domain name was registered. Be careful, this step is essential because WordPress can be capricious and quickly inaccessible if everything is not well locked.

Main method: Changing the URL from the administration interface

To change the URL from the WordPress administration interface, you need to follow these steps Click on “Settings” and select the “General” section.

1. Log in to the site. Click on “Settings” and select the “General” section.

2. As mentioned earlier, there are 2 options: the WordPress address and the site address. You need to make changes to both and save the changes.

3. This is the easiest way to make the URL change. If you get an error, chances are it’s a caching issue. You should think about emptying it, using a dedicated plugin. If nothing works, the following method may be more appropriate.

edit-post-slug-in-WordPress

Secondary method: Changing the URL from the database

Another way to change a URL on your WordPress site is to go through the database by connecting to the phpMyAdmin tool.

Be careful though, because this method is risky, and modifying the database can cause errors, or even crash the site if it is not done correctly. Don’t forget to make a backup of your site before any modification. This way, in case of a problem, it will be possible to restore the site.

To access the database, you have to connect to your hosting (your customer area) and access the interface associated with the database called phpMyAdmin. In case of difficulties finding it, you can contact the support of your host.

In phpMyAdmin, select the website database from the menu on the left. In case of doubt about the name of the database, you should also refer to the support of your hosting. Then scroll down and select the wp_options table. Please note: with WordPress the prefix “wp_” can be changed/customized, however, there is only one table ending with “options”.

By clicking on the options table, a new page appears. There are 2 options: the URL of the site (siteurl) and the home page (home). On older WordPress, it may be necessary to go to page 2 to find the latter.

To edit both, click on Edit. Change the two URLs and validate.

edit-site-url-in-database-wordpress

Is there anything left to do when the website URL is successfully changed?

Once the URL has been successfully changed, there are 2 essential steps to finalize the process:

1. Redirect the URLs

Despite the change, it should be noted that the old URLs still exist and that it is, therefore, necessary to redirect these pages to the new ones, in order not to lose traffic.

This action depends a lot on the hosting configuration; you can refer to the support for this modification if needed.

2. Inform the search engines including Google

Via the Google Search Console, it is recommended to inform Google that URLs have been modified. This will allow us to keep the SEO of these pages.

Changing the URL of a WordPress site is a complex operation for an uninformed profile. Therefore, it is recommended to contact a competent web agency. Do not hesitate to contact us if you wish to outsource this operation.