Home Technology Internet How to change or replace domain URL in MySQL WordPress database

How to change or replace domain URL in MySQL WordPress database

How to change or replace domain URL in MySQL WordPress database

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 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 effective methods of changing the URL that are simpler and less risky.

Maybe 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?

How to change or replace domain URL in MySQL WordPress database

Next, we will explain by method all the steps that must be carried out. You should be aware that editing these values ​​can 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 part under the option “Settings” is the option “General”, press click.

Two options will appear “WordPress Address (URL)” and “Address of your site (URL)”, the WordPress address is the address to access your blog and the address of your site is where your WordPress core files are located, both they 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.

Read:  How does wireless network technology work?

Change WordPress URL in wp-config.php File

How to change or replace domain URL in MySQL WordPress database

The second method to be able to change the domain URL is 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 so that you can 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 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 then you can access your website through the new URL.

Change WordPress URL with WP-CLI

This last method is done directly with the WP-CLI. This method is useful most of all for developers. Next, we will leave you an example of the command to be able 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 perform the procedures mentioned above, we recommend that you make a backup of your WordPress database so that you can recover everything in case of any failure.