How to Change WordPress Home and Site URL

home page url

If you need to migrate your WordPress website, or change the location of your WordPress installation it’s good to keep in mind how WordPress keeps track of itself via the WordPress Address and Site Address settings. Click here to learn more about WordPress Hosting.

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 / WP_HOME   The address typed in a browser to reach your WordPress blog.
  • Site Address / WP_SITEURL            The address where your WordPress core files reside.
WordPress Address / WP_HOMESite Address / WP_SITEURL

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 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:

// ** MySQL settings - You can get this info from your web host ** //

Change WordPress address directly in the Database

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

  • Backup your database in cPanel prior to making changes.
  • Use phpMyAdmin to manage your WordPress database.
  • Select your WordPress database from the left.
  • Then select your wp_options table.Your wp_ prefix may differ depending on your install settings.
  • Click Edit beside either the siteurl or home entries.
  • 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.

  • Edit your wp-config.php file.
  • At the top of the file add a define(‘RELOCATE’,true); line:

// ** MySQL settings - You can get this info from your web host ** //
  • Now visit your page in your web browser. Be sure to type in the path of your WordPress core files before wp-login.php
  • Log into your WordPress dashboard as you would normally.
  • 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