Inside your settings for your WordPress dashboard there are two fields named "WordPress address (URL)" and "Site address (URL)". These are also known as the "Home" and the "Site URL" settings for your website. These are extremely important settings, seeing how they control where WordPress thinks your site is actually located. These settings control how the URL is displayed within the admin section of your page as well as the front end of your website. These fields are used throughout the WordPress installation.

If you've ever had to move a site from one domain to another you'll find your website no longer functions unless these settings are updated. If you're experiencing a 404 site not found error after moving your website or manually updating these settings, you may need to change these settings to fix the issue. There are many different ways to change the settings however this first method is the easiest to do. 

Changing the Site URL and Home through the wp-config.php file

This method is probably the most straight forward way to updating these settings. Simply open your wp-config.php file in file manager and select "code edit". Add the following lines of code to your file. Be sure to replace 'yourdomain.com' with your actual domain name.

define('WP_HOME','http://yourdomain.com');
define('WP_SITEURL','http://yourdomain.com');

When you do this, please keep in mind that you will not be able to change these settings in the General Settings page of the dashboard.

Editing the functions.php file to make the changes to Site URL and Home

If you have set those values incorrectly, this method will help you get your site back quickly. This method actually changes the settings in the database, so you only have to do it once and then remove the code from the functions.php file. 

  1. Log into cPanel and go to file manager. Go to the current theme's functions.php file. You're going to edit the file usinf 'code edit'. To do so, select the functions.php file and right-click. Then select the code edit option. 
  2. Add the two following lines to the file, immediately after the initial "<?php" line. Be sure to replace 'yourdomain.com' with your actual domain name.
  3. update_option('siteurl','http://yourdomain.com');
    update_option('home','http://yourdomain.com');

  4. Save the file.
  5. Load the admin pages a few times and the site should come back up. If not, try clearing your web browser's cache.
  6. Once the site is up and running again, you will need to REMOVE the lines of code that you just entered. It is important you remove these lines of code immediately!

Using the Relocate Method

WordPress does have the ability to use an automatic relocation method that is developed to figure out and update those fields for you automatically. This method is designed to be a quick solution when moving the site from one server to another.

  1. Edit the wp-config.php file in file manager using cPanel.
  2. After the "define" statements in the code, add this new line:
  3. define('RELOCATE',true);

  4. Go to the wp-login.php page in your web browser.
  5. Log into your dashboard as you would normally.

When the relocate flag is set to be true, the Site URL (but not the home setting) will automatically be updated to whatever path you are using to access the login screen. This will only correct the path of the dashboard screen and not any other part of your website. You'll still need to update those manually.

Changing the URL directly in the Database

  1. Backup your database and save the copy to your local computer.
  2. Access phpMyAdmin in cPanel.
  3. Click the link to your Databases.
  4. A list of your databases will appear. Choose the one that is your WordPress database.
  5. All the tables in your database will appear on the screen.
  6. From the list, look for wp_options. Note: The table prefix of wp_ may be different if you changed it when installing.
  7. Click on the small icon indicated as Browse.
  8. A screen will open with a list of the fields within the wp_options table.
  9. Under the field option_name, scroll down and look for siteurl.
  10. Click the Edit Field icon which usually is found at the far left at the beginning of the row.
  11. The Edit Field window will appear.
  12. In the input box for option_value, carefully change the URL information to the new address.
  13. Verify this is correct and click Go to save the information.
  14. You should be returned to your wp_options table.
  15. Look for the home field in the table and click Edit Field. Note There are several pages of tables inside wp_options. Look for the > symbol to page through them.
  16. In the input box for option_value, carefully change the URL information to the new address.
  17. Verify this is correct and click Go to save the information.

If you are still having issues or have any further questions please feel free to contact our support department and we'll be happy to assist you. 

Like this Article?

Login to comment.

Your Opinion Matters

... but we need to know what you're thinking!

I'm Tim Sisson, your friendly Community Support technician, and I wrote the article you're looking at now. I like to think it's perfect, but I'm sure you have some suggestions. Please, let me know what they are!

Feedback
Your Email Address
Because we'd like to talk with you!

Latest Questions

If you need some help, submit your question to our Community!
We guarantee a response within 60 minutes (8am - 9pm EST, Monday - Friday)
Ask a Question!
Recent Questions
  1. Connecting email to gmail?
  2. Can I have Oscommerce installed on my site's server?
  3. I'm having trouble publishing with iWeb

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!