There are many ways to fix this, please follow as per information below:
WordPress stores two addresses inside the database. These determine where your blog files are, and where the main index is. On a normal install, these addresses are the same.
There are two occasions where you will need to access the database to alter one or both of these settings:
1. If you have tried to alter the Blog URL or WordPress URL in Settings, and an error has occurred.
2. If you have moved to a domain/subdomain with a different name.
BACKUP your database before you begin and store the backup off your site server, like on your hard drive. See: Backing Up Your Database.
Quick fix method
If you have access to the site via FTP, then this method will help you quickly get a site back up and running, if you changed those values incorrectly.
1. FTP to the site, and get a copy of the active theme's functions.php file. You're going to edit it in a simple text editor (like notepad) and upload it back to the site.
2. Add these two lines to the file, immediately after the initial "<?php" line.
Use your own URL instead of example.com, obviously.
3. Upload the file back to your site, in the same location. FileZilla offers a handy "edit file" function to do all of the above rapidly, if you can use that, do so.
4. Load the login or admin page a couple of times. The site should come back up.
5. Repeat the above steps, but remove those lines. IMPORTANT: Do NOT leave those lines in there. Remove them immediately after the site is up and running again.
If there is no functions.php file in the theme: Create a new text file called "functions.php". Edit it with notepad, and add this text to it, using your own URL instead of example.com:
Upload that to your theme directory, then proceed as stated above. Remove the file afterwards.
WordPress supports an automatic relocation method that will figure out and update those values for you automatically. This method is intended to be a quick assist to getting a site working when relocating a site from one server to another.
To use it:
1. Edit the wp-config.php file.
2. After the "define" statements, add this new one:
3. Go to the wp-login.php page in a web browser.
4. Login as per normal.
When the RELOCATE flag is set to true, the siteurl (NOT the home setting) will be automatically updated to whatever path you are using to access the login screen. This will get the admin section up and running on the new URL, but it will not correct any other part of the setup. Those you will still need to alter manually.
You should remove the additional line after the site is up and running. Do NOT leave it enabled.
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.
1. Backup your database and save the copy off-site.
2. Login to phpMyAdmin.
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.
18. Delete the folder wp-content/cache (this is a new folder added with WordPress 2.0).
19. That is it.
Domain Name Change
BE VERY CAREFUL WITH THIS.
BACKUP YOUR DATABASE FIRST: Backing Up Your Database.
The following is irreversible. There is no "undo" or "undelete" button. This is permanent. Be warned that it can do harm.
When moving the domain, you will need to restore the database. You then need to upload your files to their new location.
At this point, your blog will NOT work.
1. Follow the guide above to alter the information in the database.
2. Database Entries
1. Log into phpMyAdmin.
2. Backup your database and save the copy off-site.
3. Login to phpMyAdmin.
4. Click the link to your Databases.
5. A list of your databases will appear. Choose the one that is your WordPress database.
6. Look for the name of the table within your database used to hold your post information. Usually it is called wp_posts, but it may have been changed. Write it down.
7. Clicking the Browse icon or link, open the wp_posts table.
8. Look for the field that holds your post "guid". It is usually called guid, but it may have been changed. Write it down.
9. Click the tab at the top for SQL.
10. Using the information you wrote down from above and the old and new URL addresses you wish to update or search and replace within your database, type in the following (CAREFULY):
UPDATE wp_posts SET guid = REPLACE (
1. Make sure that the names of wp-posts and post_content match the tables and fields within your database. Change them if not.
2. Ensure that the ONLY content you want to change are within the little single 'quotes' . Make sure EVERYTHING is spelled right and that you are sure this is correct.
3. Review everything within the SQL input box again. Make sure it is correct. There are no second changes when you take the next action. The change is permanent.
4. When you are sure, click Go.
5. At the top of the screen will be generated a list of how many of the tables and fields have been changed.
Changing Template Files
In your WordPress Theme, open each template file and search for any manually entered references to your old domain name and replace it with the new one. Look for specific hand coded links you may have entered on the various template files such as the sidebar.php and footer.php.
WordPress uses a template tag called bloginfo() to automatically generate your site address from information entered in your Administration > Settings > General panel. The tag in your template files will not have to be modified.
Changing the Config file
You will need to update your WordPress configuration file if your database has moved or changed in certain ways.
1. You will only need to modify the config file if:
1. your database has moved to another server and is not running on your localhost
2. you have renamed your database
3. you have changed the database user name
2. "'Make a backup copy of your wp-config.php file.'"
3. Open the wp-config.php file in a text editor.
4. Review its contents. In particular, you are looking for the database host entry.
5. Save the file.
At this point, your WordPress blog should be working.
Verify the Profile
1. In your Administration Panels go to Settings > General . Here you will verify that the changes you made in Changing the URL above, are correct.
2. Verify that the reference in your WordPress URL contains the new address.
3. Verify that the reference in your "Blog URL" contains the new address.
4. If you have made changes, click Save Changes.
Changing the .htaccess file
After changing the information in your Administration > Settings > General panel, you will need to update your .htaccess file if you are using Permalinks or any rewrites or redirects.
1. Make a backup copy of your .htaccess file. This is not a recommendation but a requirement.
2. Open the .htaccess file in a text editor.
3. Review its contents, looking for any custom rewrites or redirects you entered. Copy these to another text file for safe keeping.
4. Close the file.
5. Follow the instructions on the Permalinks SubPanel for updating your Permalinks to the .htaccess file.
6. Open the new .htaccess file and check to see if your custom rewrites and redirects are still there. If not, copy them from the saved file and paste them into the new .htaccess file.
7. Make any changes necessary in those custom rewrites and redirects to reflect the new site address.
8. Save the file.
9. Test those redirects to ensure they are working.
If you make a mistake, you can Restoring Your Database From Backup from your backup and try this again. So make sure it is right the first time.