WordPress - Changing the Site URL and Home Settings
Written by Tim SissonInside 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.
- 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.
- 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.
- Save the file.
- Load the admin pages a few times and the site should come back up. If not, try clearing your web browser's cache.
- 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!
update_option('siteurl','http://yourdomain.com');
update_option('home','http://yourdomain.com');
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.
- Edit the wp-config.php file in file manager using cPanel.
- After the "define" statements in the code, add this new line:
- Go to the wp-login.php page in your web browser.
- Log into your dashboard as you would normally.
define('RELOCATE',true);
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
- Backup your database and save the copy to your local computer.
- Access phpMyAdmin in cPanel.
- Click the link to your Databases.
- A list of your databases will appear. Choose the one that is your WordPress database.
- All the tables in your database will appear on the screen.
- From the list, look for wp_options. Note: The table prefix of wp_ may be different if you changed it when installing.
- Click on the small icon indicated as Browse.
- A screen will open with a list of the fields within the wp_options table.
- Under the field option_name, scroll down and look for siteurl.
- Click the Edit Field icon which usually is found at the far left at the beginning of the row.
- The Edit Field window will appear.
- In the input box for option_value, carefully change the URL information to the new address.
- Verify this is correct and click Go to save the information.
- You should be returned to your wp_options table.
- 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.
- In the input box for option_value, carefully change the URL information to the new address.
- 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.
Latest Questions
Need more Help?
Search
Ask the Community!
Current Customers
| Chat: | Click to Chat Now | E-mail: | support@InMotionHosting.com |
|---|---|---|---|
| Call: | 888-321-HOST (4678) | Ticket: | Submit a Support Ticket |

