Skip to content

How to Change or Replace Domain URL in MySQL WordPress Database

27 de June de 2021

The WordPress address is very important, as the URL refers to the address of your site on the web and the location of your site files. Sometimes it is risky to do this without following the steps correctly because if the URL is changed, the other files with the same name will fail. That is why we recommend that you learn in more detail about what the URL is, what it is for and what its parts are.

Although it is a bit complicated to do so, there are many methods that are effective for change url that are simpler and less risky.

Perhaps you are needing to change the domain URL, moving a subdomain, updating from www to non-www, moving files, or migrating from HTTP to HTTPS. Whatever your case, we will try to explain in an easy and simple way the steps to be able to make this change using different methods. And in case you cannot find a URL, we will teach you how to search and find a specific URL in Google

How to change domain url in WordPress?

Next we will explain by method all the steps that must be carried out. You should be aware that editing these values ​​may result in the inactivity of your site if they are not entered in the correct way, so you should be as careful as possible.

Change WordPress URL in Admin Dashboard

This is the most common method of all, as it relies on changing the URL directly from the control panel as an administrator. In the left side below the “Settings” option you will find the option “General”, press click.

Two options will appear “WordPress Address (URL)” and “Your site address (URL)”, the WordPress address is the address to be able to access your blog and your site address is where your WordPress core files are located, both must have the same URL.

After updating it or having changed the domain URL, you must click on “Save changes” and this way you will be able to access your blog through the new URL that you configured. In case you use Blogger you can also change or customize a URL of a post.

Change WordPress URL in wp-config.php File

pointer over link to web page

The second method to be able to change the Domain url it’s via your wp-config. It should be noted that the wp-config values ​​override the settings of the previously mentioned method. In case the fields are not editable it is because they are probably encrypted in the files.

The wp-config file is located in the root of your WordPress site and can be accessed via FTP, SSH or WP-CLI. In order to encrypt WP_HOME and WP_SITEURL simply enter the following code at the top of the file to be able to change the values ​​to reflect your domain.

  • define (‘WP_HOME’, ‘https: //yourdomain.com’);
  • define (‘WP_SITEURL’, ‘https: //yourdomain.com’);

Change WordPress URL from database

This method of changing the WordPress URL it is done directly from the database using phpMyAdmin, which is accessible from your MyKinsta dashboard, although it would be used as a last resort.

Before explaining the procedure it is important to remember that editing or manipulating tables directly from phpMyAdmin can damage your site if it is not done in the right way. If you are not sure how to perform this procedure, it is best to contact someone who has more experience performing these types of procedures.

The first thing to do in phpMyAdmin is to click on your database on the left hand side. Then you need to scroll down and click on the “wp_options” table. If your database has a prefix you can change it if you want.

The next thing to do is edit the values ​​of the “Siteurl” and “home”, you must enter your domain or URL and click “Go” and you will then be able to access your website through the new URL.

Change WordPress URL with WP-CLI

This last method is performed directly with WP-CLI. This method is useful mostly for developers. Here is an example of the command to update the values ​​of your WordPress URL:

  • wp option update home ‘http://example.com’
  • wp option update siteurl ‘http://example.com’

Since it is not so easy to carry out the procedures mentioned above, we recommend making a backup copy of your database. WordPress data so you can get everything back in the event of a failure.