If you want to start a journey with MySQL database then you need the best web hosting company provider for your business. If you are thinking of changing WordPress URLs in MySQL database then its the better article for you.
In this article, we will share easy steps to change your WordPress site URLs. WordPress is one of the popular online open-source website creation tools.
WordPress is an easy and most powerful website content management system. Follow the below simple method to change your WordPress URL in the MySQL database.
Find the Name of WordPress MySQL Database
The cheapest wordpress hosting India stores MySQL database name and other details in the wp-config.php file. This file is available in your root file directory:
- Login to your cPanel and open File Manager.
- Choose the domain name, and then press on Go to File Manager.
- Next open wp-config.php and find the DB_NAME. The content of this parameter is your database name.
Change WordPress URLs in MySQL Database
In PhpMyAdmin, you can easily change all links on your website through directly updating the old URL in the WordPress database.
- First, go to the phpMyAdmin section through your website control panel.
- Then the left panel list is all of your databases. Select your database name and go to the SQL tab. SQL Tab allows you to quickly make changes to your database, simply inserting the appropriate code.
- Enter the following SQL query into the SQL Tab to change the WordPress URL. Before, you have to update oldurl.com with your current WordPress site URL and newurl.com with your new WordPress site URL.
UPDATE wp_options SET option_value = replace(option_value, ‘oldurl.com’, ‘newurl.com’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’;
UPDATE wp_posts SET guid = replace(guid, ‘oldurl.com’,’newurl.com’); UPDATE wp_posts SET post_content = replace(post_content, ‘oldurl.com’, ‘newurl.com’); UPDATE wp_postmeta SET meta_value = replace(meta_value,’oldurl.com’,’newurl.com’); |
- Click on the Go button to execute a given query. You will receive a successful message. Now your current WordPress URL would be updated with the new WordPress URL.
- The last step you necessitate to do is check all changes. First, open the wp_options and check the option_value of site URL and home. You should see your new WordPress URL.
Different Method to Change WordPress URL
You can skip this part if you understand how to change the WordPress URL in the MySQL database. There isn’t a single way to change the WordPress URL. In many different ways, you can change the WordPress URL.
- Change the WordPress URL in the Admin area
- Change the WordPress URL from wp-config.php File
- Change the WordPress URL Using functions.php File
- Change the WordPress URL By WP-CLI
Follow the various methods to change the WordPress URL. Now, let’s understand step by step to change the WordPress URL.
-
Change the WordPress URL in the Admin area:
In this method, you have to enter the new site URL in two fields. First, access your WordPress admin area. It is the most common and easy method to change your WordPress URL.
Log in to your cPanel account and go to “Settings » General page then you will see two options such as WordPress address, site address. Only, you have to enter your new URL in both fields to change your WordPress URL.
- The Site Address(URL) is the address that people type in their browser to reach your WordPress website.
- The WordPress Address(URL) is the address where your WordPress core files exist.
Click on the Save Changes button. Now, visit your website to make sure your website URL update or not.
-
Change the WordPress URL in wp-config.php File:
First, you create a site backup and a copy of the current wp-config.php file before you start editing. The wp-config.php is a main WordPress configuration file generated when the WordPress installation.
In this method, you have to add the site URL to your WordPress configuration file named wp-config.php. Log in to your cPanel account and go to the File Manager. Find the wp-config.php file in the root of WordPress installation.
Just connect to your website using an FTP client and update the wp-config file that adds two lines of following code.
define( ‘WP_HOME’, ‘https://example.com’ );
define( ‘WP_SITEURL’, ‘https://example.com’ );
The https://example.com replaces your new WordPress site URL. Now save the changes and upload them back to your server. After that, visit your website to make sure the site URL is updated or not.
-
Change WordPress URL Using functions.php File:
Change the WordPress URL using functions.php file. That method is only for those users who cannot access the admin area of their WordPress website. You have to connect your WordPress site using an FTP client.
Go to the /wp-content/themes/your-theme-folder/. Once you locate the functions.php file and edit it using a plain text editor such as Notepad. Now, you want to add the below two lines of code:
update_option( ‘siteurl’, ‘https://example.com’ );
update_option( ‘home’, ‘https://example.com’ );.
The https://example.com replace with your new site URLs. Now save all changes and upload the file back to your site hosting using FTP.
4. Redirection After Changing WordPress Urls
Once you transform your WordPress URLs, then you thought to ensure anybody working with the older URL is redirected into the brand new URL and will not have any mistakes. Our team takes review to read this for all types of reasonable SSD reseller hosting solutions under the exploration method.
In case you are with set up redirection with . Practice our knowledge-base guidebook to re-direction to master just how exactly to execute this and browse our guidebook to divert best-practices.
And to prevent redirect errors including lots of redirects’ and also figure out how to set this up therefore that it will not affect your web page’s efficiency. You may also must put in redirects for different pages or posts, but wild-card redirection is significantly more inclined.
In case you are unfamiliar with Kinsta, then learn if your web hosting provider enables you to set up wild card redirection on your controller panel.
When you are jogging top quality in your own website and you also have to edit that URL of different articles or pages. Then the plug-in will routinely set up arrangements on you personally, and therefore that you do not need to get this done by hand.
5. Determining the Name of WordPress MySQL Database & Home Setting
You may ignore this section in the event that you just have a single particular MySQL database. But when you’ve got several databases and also not sure which one is joined with WordPress. We are discussing following tips :
You may discover this document on your root directory listing:
- Accessibility to your cPanel and start document supervisor.
- Choose the domain name, click proceed to document supervisor
- Open up wp-config.php and look for DB_NAME. The worth of the parameter can be your own database title. For example, the identity of the MySQL database will be currently in file name.
Conclusion:
There are a lot of complicated best hosting methods out there to change your WordPress site URL, but changing the WordPress URL in the MySQL database is quite easy.
Always make sure to do a backup of your WordPress sites, before changing the setting of the site URL. With the many website backup plugins available in WordPress, you can manage the backup feature in cPanel.
We hope this article can give you clear guidance on how to change WordPress URLs in the MySQL database. Follow the one simple step to change the WordPress URL in the MySQL database.