WordPress – Changing the Site URL and Home Settings

Share on facebook
Facebook
Share on google
Google+
Share on twitter
Twitter
Share on linkedin
LinkedIn

These settings can be adjusted directly in the WordPress admin dashboard from Settings >> General or you can make these modifications to your wp-config.php file as well.

WordPress WP_HOME and WP_SITEURL settings

There are 2 WordPress options that you can adjust to change the behavior of how WordPress works.

  • WordPress Address (URL)/WP_SITEURL: The address where your WordPress core files reside.
  • Site Address (URL)/WP_HOME: The address typed in a browser to reach your WordPress blog.

As you can see from the example above, I have my WordPress core files stored inside my /public_html/wp directory so that they aren’t clogging up my root directory.

However I still want people just to type in http://example.com to get to my WordPress site, so I’ve left that set as my Site Address so WordPress knows this is what I want displayed instead of the core files location.

This is just one example of what can be done with WordPress URL settings. You might also need to modify these settings after moving your WordPress website to a new server, or testing a new structure for your website.

Change WordPress address in admin dashboard

You can also adjust your WordPress URL settings directly from the admin dashboard. This method will typically work if you haven’t moved your WordPress installation and aren’t having any issues access it.

  1. Login to WordPress admin dashboard
  2. Click on Settings >> General
  3. Fill in your WordPress Address and Site Address and click Save.

Change WordPress address with wp-config.php file

The easiest way to modify your WordPress URLs is via the wp-config.php file. If you’ve moved your WordPress site or are trying to test it from a temporary URL, this also might be the only method that works for you.

Be aware with these settings in the wp-config.php file, the ability to modify them from the dashboard is lost.

  1. Edit your wp-config.php file.
  2. Define your WP_HOME and WP_SITEURL settings by inserting these lines towars the top:
define('WP_HOME','http://example.com'); define('WP_SITEURL','http://example.com');  // ** MySQL settings - You can get this info from your web host ** //

Change WordPress address directly in the Database

You can also diretly modify your WordPress URL settings in the WordPress database using the phpMyAdmin tool.

1- Backup your database in cPanel prior to making changes.

2- Use phpMyAdmin to manage your WordPress database.

3- Select your WordPress database from the left.

4- Then select your wp_options table.

Your wp_ prefix may differ depending on your install settings.

5- Click Edit beside either the siteurl or home entries.
You may need to search for them with the Filter rows function at the top.

6- Enter in your new value in the option_valuie field, then click Go

Detect and change WordPress address with RELOCATE

If you’re having issues accessing your WordPress dashboard, you can have WordPress automatically try to figure out what the correct WordPress Address should be using the RELOCATE flag in your wp-config.php file.

With the RELOCATE flag set, WordPress will automatically update your WordPress core files path to the URL used to attempt to access the wp-login.php script. This only affects the WordPress dashboard and not the site itself.

  1. Edit your wp-config.php file.
  2. At the top of the file add a define(‘RELOCATE’,true); line:
define('RELOCATE',true);  // ** MySQL settings - You can get this info from your web host ** //
  1. Now visit your http://example.com/wp/wp-login.php page in your web browser.Be sure to type in the path of your WordPress core files before wp-login.php
  2. Log into your WordPress dashboard as you would normally.
  3. If you navigate to Settings >> General, you should now see that WordPress has automatically populated the WordPress Address (URL) field for you, with the path to your WordPress files.

More to explorer

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.