Changing WordPress Address (URL) Through Database

WordPress Address (URL) holds the WordPress core files. In WordPress, SQL database is used to store all the data like posts, configuration and pages. In SQL tables, WordPress URLs should be changed if the WordPress website is changes to different folder or domain name is changes. WordPress address can be changed with wp-config.php file, phpMyAdmin tool and base URL in WordPress settings. Also if you are not able to login into your wordoress dashboard due to some wrong URL issue then you can also change the URL in wp-config.php file and phpMyAdmin tool.

Changing WordPress address with wp-config.php file

WordPress address can be modified through wp-config.php file. This file contains the database name and credentials. wp-config.php file is available in the root WordPress file directory. This file can be accessed through FTP client’s File Manager.

Step 1: Log into the site using FTP or cpanel.

Step 2: Edit the wp-config.php file to change the WordPress address and define the WP_SITEURL and WP_HOME settings.

You just have to add below lines in your wp-config.php and enter your required URL:

Code:
define('WP_HOME','http://domainname.com);
define('WP_SITEURL','http:// domainname.com’);
Changing WordPress address through phpMyAdmin Tool

One can directly modify the WordPress address URL settings using phpMyAdmin tool.

Step 1: Log into cPanel account.

Step 2: In the Database section select the “phpMyAdmin” icon.

phpmyadmin.png


Step 3: Select the “wp_option” table by expanding the database linked with the WordPress Installation. Wp_prefix may vary as per the install settings.

options1.png


Step 4: In the “option_name” column, search “siteurl” and “home”. These two options establish the WordPress URL and the changes made here has the same influence as making changes in General Setting of WordPress.

Step 5: Select the pencil icon next to “Edit”. Now the domain name can be changed by entering new value for “option_value”. Make sure that the directory name is not changed.

options2.png


Step 6: Click “Go” button to save the settings. Now the page will be directed to wp_options table and the new domain is seen here.

options3.png


Step 7: Do these changes for both “siteurl” and “home” options.

Changing base WordPress Address in WordPress Settings

WordPress depends on the base URL for loading the media and pages. As we move WordPress site to many URL, we should update the base URL in the WordPress settings.

Step 1: Log into WordPress Dashboard.

Step 2: Go to “Setting” and select “General” option.

general1.png


Step 3: Update the “WordPress Address (URL)” and “Site Address (URL)”. Save the changes.

general2.png


Step 4: Log out the WordPress Dashboard and close the browser window. Don’t load the site for a while.
Author
Bhawani Singh
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from Bhawani Singh

Top