WordPress – Changing Site URL and Home Settings

Posted at December 23, 2016 at 12:20 pm by Jithin

In this tutorial we can check how to change WordPress Site URL and Home settings.

WordPress is a free and open-source content management system(CMS) based on PHP and MySQL. WordPress keeps track of itself via WordPress address and site address settings. If you change the location of WordPress installation or migrate your WordPress website, you need to change the URL of your WordPress website. It is a common practice to develop the new version of your WordPress website in a subfolder and move it to the main directory, when the website is developed. But your WordPress website will not work properly, if you simply move all your files and database to another location. It is because WordPress relies on its URL settings to work properly.

 

WordPress Address and Site Address

WordPress address is where your WordPress core files resides. The WordPress admin pages along with other important parts such as /wp-content/, /wp-include/ lies here. It is where the brain codes of your WordPress website lie. WordPress site address is the URL typed in a browser to reach your WordPress website. It is the URL that your visitors use to visit your website. Both the addresses are same for a normal WordPress installation. These addresses vary when you have installed your WordPress in a directory other than your public home page(public_html). If you want your root directory free from WordPress directories and files, then install it on any other directory under the root directory.

 

Change WordPress address in admin dashboard

Follow the below steps to modify WordPress URL settings directly from admin dashboard.

1) Login to WordPress admin dashboard.

2) Click on Settings >> General.

3) Fill in your WordPress address and Site address.

4) Save the settings.

 

Change WordPress address with wp-config.php file

The default download package of WordPress does not include the wp-config.php file. Instead it contains wp-config-sample.php which is renamed to get the wp-config.php file. It is one of the core files of your WordPress website. It contains significant information about the database, WordPress home and site URL settings. We can easily modify the WordPress URL via wp-config.php file. This method is very useful when you lost the ability to modify them from your WordPress dashboard.

1) Using your favorite editor, edit wp-config.php file.

2)Add or modify the below lines and save file.

—define(‘WP_HOME’,’http://interserver.net’);

—define(‘WP_SITEURL’,’http://interserver.net’);

Replace ‘http://interserver.net’ with your home address and site URL.

 

Change WordPress address with Relocate

If you have any issue in accessing your WordPress admin dashboard, set Relocate flag value to ‘true’ in wp-config.php file. WordPress will then automatically figure out what address should be using Relocate flag in wp-config.php file.

1) Using your favorite editor, edit wp-config.php file.

2) At the top of the file add the below line and save file.

—define(‘RELOCATE’,true);

3) Visit your http://example.com/wp-login.php in your browser. Replace http://example.com with your WordPress core files.

4) Login to your WordPress dashboard and navigate to Settings >> General and you should see WordPress has already modified the ‘WordPress Address’ field.

 

Change WordPress address with function.php

Each WordPress theme has a function.php file in it. Using this file, we can update the WordPress address into the database. The direct modification of database can be avoided by using a nice function ‘update_option’ in the function.php file.

1) Using your favorite editor, edit function.php file of your theme.

2) Simply add the below lines and save file.

—update_option(‘siteurl’,’http://www.new-site-address.com’);

—update_option(‘home’,’http://www.new-site-address.com’);

3) Load your website from its new location

4) Once you run your website successfully make sure to delete those lines from your function.php file.

 

Change WordPress address with phpMyAdmin

Using phpMyAdmin, you can directly modify and update your WordPress address in database. Follow the below steps to change the WordPress address.

1) Login to your phpMyAdmin

2) Create a backup of your database before making changes.

3) Select your WordPress database from the left

4) Select wp_options table

5) Click Edit beside either the site url or home entries

6) Enter your new WordPress address in the option_value field and then click go

 

If you need any further assistance please contact our support department.

 

 

4.00 avg. rating (79% score) - 1 vote

You can skip to the end and leave a response. Pinging is currently not allowed.

Leave a Reply