Sometimes mistakes or installations on the incorrect URL can make it necessary to be able to change the site URL through PHPMyAdmin.
Do you have a WordPress site that is trying to load the wrong URL? Is http://example.com coming up instead of http://example.com/wordpress ? Or http://123.234.12.13/~somename instead of http://yourdomain.com ?
Here is how to fix it! (Be careful, as you do this. If you’re unsure of yourself, backup your database first: http://codex.wordpress.org/Backing_Up_Your_Database)
First log into PHPMyAdmin.
Enter your username and password. (Note, for BlueHost users, if you are unable to log into PHPMyAdmin, you may need to set your MySQL Password first. This can be set using the “Reset MySQL Password Link” also shown in the screenshot above, and featured in the screenshot below)
A list of your databases will appear on the left. Select your desired database then click the browse icon for the options table. Hovering over this icon should show the word “browse”. (If you aren’t sure which database is the right one, check your wp-config.php file to check what your database is)
(Don’t worry, I cleaned up my overhead after!)
You will then be presented with a lot of options. Look for the option_name of siteurl and click the little pencil(edit) icon.
After clicking the pencil button, you should see something like the below screenshot. Change the URL in the option_value field, but do not change anything else. (Do *not put a slash after the URL.) Then click “Go”.
You will be taken back to the screen you were on previously. Here you will need to go to the second page. Click the arrow button as shown below:
Once again you will see a long list of options. Look for the home option_name and click the little pencil icon again:
Once again you will be taken to a screen where you can edit the option_value. Change the URL in the option_value field, but do not change anything else. (Do *not put a slash after the URL.) Then click “Go”.
That should be it! Your site URL has now been updated!
—————————————————————-
(On a separate note, if you had a lot of posts, chances are that images and internal links within your posts may still be broken. You can do the following to fix it.)
In PHPMyAdmin, go to your wp_posts table and click the SQL option at the top. Put something like the following code into it. (Be sure to replace the URLs with your real old and new locations.):
UPDATE wp_posts
SET guid =
REPLACE(guid,
"olddomain.com/wordpress",
"www.newdomain.com");
Click “GO” and … that’s it! You’re done.
(On another separate note, sometimes you have to update your .htaccess too. For example, if you moved your site from domain.com/wp to just domain.com, you would need to edit your .htaccess and change the RewriteBase from /wp/ to just / and also change the RewriteRule line from . /wp/index.php to just /index.php )











12 Comments until now
Hello, Sir
Its the most great information available to help someone out, i was also sucked that how to perform this task but now i know to change the url. You Rocks..
Big Hug from my side..
I’m not a programmer but still your guide was truly amazing.
Thanks
dotn know how. did so much research,
U put it simply and it worked
thanks
Very useful – Thank you! I used also the following statement to replace all urls in the post content: UPDATE wp_posts SET post_content =REPLACE(post_content,"olddomain.com/wordpress","www.newdomain.com");
Please help!
This is killing me. No matter what I cant seem to get PHP to save the correct URL after I press go. It always reverts back to the incorrect URL
Blog: http://ceosmind.com
Incorrect url http://wcf.tylerfalwell.com
Your main URL does appear to be set properly(though it’s http://www.ceosmind.com and not ceosminde.com). It’s just the images and other content that is incorrect.
Try running the query included above and replace "wcf.tylerfalwell.com" with "www.ceosmind.com"
Make sure you do the changes on the correct database. Check your wp-config.php to see which database it is.
You may want to make an export/backup of your database before doing this, just to be on the safe side.
thanks for this.. i will check this out later.. i hope it would fix my problem.. thanks again have a nice day
Holy smokes. This totally saved my bacon. Huge learning opportunity this afternoon… into evening… along with some panic.
Huge huge thanks for this page. Sometimes you just need something in plain language.
wow. thanks for this page. really save me the time
I hate wordpress for this. Everytime I update my template I just have some errors here and there
That got me out of a pickle. Ive only just started this site for trying to sell my house but i really screwed it up by adding the wrong URL in the settings tab. Thanks for this info really sorted me out
If you want to move your site from one url to another, just change the URL in Dashboard > Settings > General, then move the files on the server. Most people mess it up and have to use this method to fix it.
tank you
was helpful for me
Add your Comment!