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.

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 where your WordPress core files reside.
  • Site Address / WP_SITEURL   The address typed in a browser to reach your WordPress blog.
WordPress Address / WP_HOME Site Address / WP_SITEURL
cPanel File Manager showing WordPress core files Web browser showing WordPress site URL setting
WordPress URL settings in admin dashboard

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 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://yourdomain.com');
    define('WP_SITEURL','http://yourdomain.com');
    
    // ** MySQL settings - You can get this info from your web host ** //

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 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. phpMyAdmin select WordPress databaseSelect your WordPress database from the left.
  4. phpMyAdmin select WordPress options tableThen select your wp_options table.

    Your wp_ prefix may differ depending on your install settings.

  5. phpMyAdmin click edit on siteurlClick Edit beside either the siteurl or home entries.
  6. phpMyAdmin update siteurlEnter in your new value in the option_valuie field, then click Go
  7.  

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 ** //
  3. 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

  4. Log into your WordPress dashboard as you would normally.
  5. 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.
Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve our Support Center:
Email Address
Optional, but our team may contact you for more information.
Like this Article?

Comments

Post a comment
2013-06-06 1:25 pm
I would like my display URL to read www.example.com, not example.com. I've changed this in the past, in the General Settings, and my website went away with errors everywhere. All I did was add the "www" to the beginning of each. I couldn't even load the login page. So I'm reluctant to mess with these setting again.

Even with your explanations here, I'm still not sure how these 2 setting work or what their real purposes are. There are two setting WordPress URL and Site URL, you referred to a "Home" URL... is this a third option or is Home the same as WordPress?

Also, If I change these two settings and my site crashes again, do I recover by editing the the wp-config file, or the functions.php file?

I know this shouldn't be this difficult, I just want to add the WWW. Thanks for your help.
Staff
10,626 Points
2013-06-06 1:48 pm
Hello LenEstrada,

Sorry to hear that you're confused and having problems with this issue. I looked it up through the Wordpress.org Forums and found this suggestion:

1) Login to the Wordpress Administrator
2) Click on SETTINGS
3) Click on GENERAL
4) The forum post I read suggests that BOTH of those URLs should be set to use WWW.

Here's the link to the post if you need it: Force WWW in WordPress.

I hope this answers your question! Please let us know if you require any further assistance.

Regards,
Arnel C.
n/a Points
2014-04-13 1:54 am

I have having problem connecting to my admin loginon wordpress, I tried the step above, but I was redirected to my home page instead of my login page

Staff
4,269 Points
2014-04-14 9:06 am
Take a look at the address bar. Did it redirect to another domain from before you changed the site URL?
n/a Points
2014-04-14 2:33 pm

I follow the step above, the issue has been fixed, All I had to do was just to wait for sometime, the wordpress login page was overided with the site login page. All is working fine. Thanks for the help

n/a Points
2014-04-17 1:31 pm

I built a test website using an extension :

www.website.com/test

now I want to move the extension "test" to Website.com

I want the contain of website.com to be what I build under "test"

Staff
5,642 Points
2014-04-17 5:05 pm
Hello Rausty, and thanks for the comment.

You would have two options in order to move WordPress from a subfolder such as example.com/test to just example.com.

You can either move all of your files from the /test directory up one level to your main site's document root. This is the recommended method to ensure that everything with WordPress continues to function properly.

Or you can also just tell WordPress to utilize the files in the /test directory and just copy over 2 WordPress files if you'd like to keep your document root clear of all the WordPress files. This can complicate matters a bit, but you just have to keep in mind when trying to access things like /wp-admin to login to WordPress, you'd still need to use example.com/test/wp-admin.

The first option of simply moving your entire WordPress site from a subfolder to your document root could be completed with these steps:


  1. Login to WordPress

  2. Hover over Settings then click on General

  3. Both your WordPress Address (URL) as well as your Site Address (URL) settings should both say http://example.com/wordpress

    You'll want to change both to just read http://example.com


    Now you'll want to click on Save Changes, but note that as soon as you do WordPress will throw a Error 404 - Not Found error.


  4. Now you'd want to move all of the files and folders from your /test directory to your main document root.



The second option of making your WordPress site accessible from just the document root of your website, while still retaining the bulk of the WordPress files in a /test folder. Could be setup following these steps:


  1. Login to WordPress

  2. Hover over Settings then click on General

  3. Both your WordPress Address (URL) as well as your Site Address (URL) settings should both say http://example.com/wordpress

    Change just the Site Address (URL) to http://example.com


  4. Copy DO NOT MOVE the /test/.htaccess and /test/index.php files to your main document root.

  5. Edit the index.php file now sitting in your document root and change this line:

    require( dirname( __FILE__ ) . '/wp-blog-header.php' );


    To this:

    require( dirname( __FILE__ ) . '/test/wp-blog-header.php' );


    Then save the file and you should be able to access WordPress from your main example.com now.



Please let us know if you had any further questions at all.

- Jacob

Post a Comment

Name:
Email Address:
Comment:
Are you a bot?
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

Related Questions

Here are a few questions related to this article that our customers have asked:
wordpress temp URL to correct domain name
Adding a WordPress site to our account
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!