Changing WordPress URL

peppermi

Member
Messages
118
Reaction score
8
Points
18
[stextbox id="alert"]Alert! These directions are for single installs of WordPress only. If you are using WordPress MultiSite, you will need to manually edit your database.[/stextbox]
On the Settings->General screen in a single site installation of WordPress, there are two fields named "WordPress address (URL)" and "Site address (URL)". These are also known as the "Home" and "Site URL" settings. They are important settings, since they control where WordPress thinks your site is located. They control the display of the URL in the admin section of your page as well as the front end, and are used throughout the WordPress code.
trans.gif


  • The "Home" setting is the address you want people to type in their browser to reach your WordPress blog.
  • The "Site URL" setting is the address where your WordPress core files reside.
Note: Both settings should include the http:// part and should not have a slash "/" at the end.

Every once in a while, somebody finds a need to manually change (or fix) these settings. Usually this happens when they change one or both and discover that their site no longer works properly. This can leave the user with no easily discoverable way to correct the problem. This article tells you how to change these settings directly.

Additional information is presented here for the case where you are moving WordPress from one site to another, as this will also require changing the site URL. You should not attempt to use this additional information if you're only attempting to correct a "broken" site.

Edit your Admin Settings
1. Go to Settings

2. General

3. Edit WordPress Address (URL)



Edit wp-config.php
It is possible to set the site URL manually in the wp-config.php file.

Add these two lines to your wp-config.php, where "example.com" is the correct location of your site.

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

This is not necessarily the best fix, it's just hardcoding the values into the site itself. You won't be able to edit them on the General settings page anymore when using this method.

Changing the URL directly in the database
If you know how to access phpMyAdmin on your host, then you can edit these values directly to get you up and running again.

Backup your database and save the copy off-site.
Login to phpMyAdmin.
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.
 
Top