Tags:



I know *just enough* to be dangerous...
May 15, 2011 6:18 AM   Subscribe

How to unbreak my wordpress install after trying to change base URL?

I was trying to change from having my blog at example.net/blog to example.net. Now I get 404s galore. I won't let me log in to undo what I did in the control panel. I'm not afraid of the command line, nor Linux. I have ftp access to everything (running on dreamhost). My knowledge of php and MySQL is limited to how to spell them.

Worst case scenario (?) I have a daily dump of the database, but I wouldn't know what to do with it. Just reinstall using Dreamhost's installer? Cry? Promise never to play with things again?
posted by kathrynm to computers & internet (7 answers total) 2 users marked this as a favorite
PS: Real site is in my profile. Please don't laugh at my 1994 html front page. It's really the best I could do. That's why I wanted to move to example.net so I could do a static front page in Wordpress.
posted by kathrynm at 6:19 AM on May 15, 2011


No need to reinstall.
There are plugins to change this back but one way is listed here: http://codex.wordpress.org/Changing_The_Site_URL
Use the 'Edit wp-config.php ' method.
posted by episodic at 6:29 AM on May 15, 2011


If you can edit the database look for the options table - the option you're probably looking for is 'siteurl', you may also want to look at 'home'

Is your wp install physically in www.example.net/blog? If so the easiest way to move it to example.net is to move the files out of the /blog folder
posted by missmagenta at 6:31 AM on May 15, 2011


To change the base URL of a wordpress site, you need to do a couple of things.

1. Move index.php to the directory you want it to load from.
2. Edit index.php so that the reference to where all the files are is correct.
3. Change the location in the set up menu of Wordpress.

Did you do all three? Failing to edit index.php will cause 404s because none of the files are where Wordpress is looking.
posted by COD at 6:31 AM on May 15, 2011


Regenerate your permalinks settings (this will regenerate the .htaccess file WordPress depends on).
Also, I've found that downloading a SQL dump and find/replacing all old http://oldsite.com/ to http://newsite.com/newurl/ links also works wonders for broken images and file references.

Also, as many others point out - check your wp-config.php file.
posted by davemee at 7:19 AM on May 15, 2011




If you have access to phpMyAdmin, you can run some SQL commands to change all the URLs in the database.

UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldsite.com', 'http://www.newsite.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldsite.com','http://www.newsite.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldsite.com', 'http://www.newsite.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://www.oldsite.com', 'http://www.newsite.com');


This is from the "Update the Database" section on
http://www.billerickson.net/how-to-move-your-wordpress-website/

I used this to successfully & painlessly move a WordPress site on Friday, so I'll confirm that it works & won't sneakily change your site to LOLcats & RickRolls.
posted by belladonna at 10:33 AM on May 15, 2011


THANK YOU A ZILLION TIMES OVER!!!!!!!!!!!!


The link from eposodic finally got me there. I had to go into my theme. I swear I promise never to try to make my blog look better. Especially at 9 pm on a Sunday night.

I think because my knowledge of php is limited to its spelling, I'll try to make my landing page a bit less ugly. Or perhaps bribe my brother to make the necessary changes to make the base url example.net.
posted by kathrynm at 4:03 AM on May 16, 2011


« Older A number of technology experts...   |  Film, fiction, philosophy, or ... Newer »
This thread is closed to new comments.