Moving WordPress

Moving WordPress may seem like a huge, daunting task to someone who looks at a phpMyAdmin interface and thinks “If I touch this, the world will explode.” There are many, many ways to move your WordPress installation, and you’ll be quite surprised to learn exactly how easy it can be.

For your pleasure, I have a guinea pig for this one :) You can thank Jacqueline for allowing me to do this for her. (I’ll pass the link later – because I’m literally moving WP for her – into a whole new directory, up one level from where it is now! So once I’m done, the link will be changed :) )

So I have favorite methods for moving a WordPress installation. There’s the official method, and there are other standby “absolutely safe” methods (such as using the “Import/Export feature that’s built in to the newer versions of WP), but me, I’m impatient, and I like things to be down and dirty, and fast. So I’m going to show you my favorite way of doing this.

NOTE: Craig posted a really great – and even easier – way of doing this if all you’re looking to do is change the “slug” of where WordPress is located. Just scroll down to the comments section and find his post. If that’s all you’re looking to do – then by all means, try his advice first!

Warning: Be absolutely sure you have a backup before you try this. I’m not kidding. If you screw up, and you don’t have a backup, you can kiss your blog goodbye. Although I can say that I have yet to seriously mess a site up by this particular method (you’re not really messing with too much stuff, but still…) I’m not taking any responsibility whatsoever for you choosing to follow this method. So play it smart – get a backup before you even try any of this.

So, here we go…

Jacqueline’s blog is located at http://ascenderrisesabove.com/wordpress. (I’m not linking it because it’s gonna be a dead link in a few minutes.) She’s decided that she wants the WordPress installation to no longer be an add-on – but have it be the site – so she wants to move it to the root, and have the url be http://ascenderrisesabove.com/.

You’re going to need a couple of things for this: 1 – a freaking BACKUP. In case you didn’t listen to me before – BACK IT UP! You can do this several ways: there’s actually a few WP plugins out there that you can install to get backups; you can log into your hosting control panel and get into the phpMyAdmin interface and export the database as an SQL file, or you can use the WordPress’ export feature.

Since we’re following “my favorite method,” and we’re staying on the same server (it’s not like we’re changing hosts here, just moving up a level), then I’m going with option #3. The fact that our guinea pig also uses GoDaddy as her web host is also an extra-great reason to be using the WP export feature. (I don’t know about you, but sometimes GoDaddy’s interface can be a headache to muck around in – so let’s avoid doing that, shall we?)

And a final disclaimer: I’m actually doing this while I type this post. This is about as live as you can get. So if I run into an issue, you’re gonna see how I handle it. I actually kind of hope I do, because then you can see how easy things are to fix – but I’m willing to lay down money that this is going to go glitch-free.

So, #1 – let’s get that backup. Log into your WordPress back-end. (oh, bad girl – she needs an upgrade. We’re just going to do that for her – but we can save that for later – it won’t be a part of this tutorial.) She’s running 2.3.3, so we’ll be navigating to “Manage>Export.” Now, you can choose to restrict your backup to particular authors – but we’re moving the whole shebang – so let’s just leave the default at “All” and click the button. Save the file to your downloads folder, and there you go – you now have an XML file of all the posts, and comments on the site.

WordPress Export Screenshot

Now, if you so desire to have a more “stable” backup, you can go into the phpMyAdmin interface and “Export” your WordPress database. Just be sure to click the “Add Drop Table” option, and check the “save as file” option before you export. Do the same thing there – just click the “Go” button and it’ll save an SQL hard copy/dump into a file on your computer. She has a “Backup” plugin here though, so I’m going to use that as a secondary backup – just to be extra-sure she’s got it secured.

::cue elevator music here while we wait for everything to back up – damn this is a huge site! LOL::

WordPress Options Page Screenshot

Okay – now that that’s finished, we do two simple things which will result in your site breaking (but not for long, I swear it). Now you want to go to the “Options” page (“Settings” in 2.5+), and right there in “WordPress Address (URL)” and “Blog Address (URL)” we want to change those to reflect the new settings – so lets get rid of the extraneous “/wordpress/” at the end. Keep in mind – as soon as you save this change, your site WILL break! Don’t worry though – take it as a sign that things are working as they should :)

Now you want to open up your FTP program. Get into your system. Now you’ll see the “wordpress” directory here (and really quickly, I’m checking the filesystem of the root directory to be sure we won’t be overwriting any important files…and no, we won’t. however she does have an “index.htm” file here – so we’ll want to rename that in a moment, because it’ll override the index.php file). FTP ScreenshotYou want to get into that directory and select ALL files and folders – make sure they’re all highlighted (except, of course, the very first folder – that’s the next level up), and then drag everything into that first folder. This is moving all the necessary WP files into the root directory. Now you will see that everything has moved out of the old directory and up one level.

And BAM. there you have it. Done. Didn’t even need to use the backups. Visit the page, and it’s exactly where it needs to be. How easy was that?

Now I’m going to go upgrade her :)

EDIT: whoops! I almost forgot! We need to give her one teensy little fix. Since the URLs have changed, we also want to stick in a 301 redirect so she doesn’t lose any ranking she might have. So I’ve downloaded and installed the Redirect plugin for her. Strike that – that didn’t work. I did two things: I edited the .htaccess file and put in a PHP redirect in her old /wordpress folder, so that Google will know everything has permanently moved. Old permalinks any still be messed up though – but to her regular readers, that shouldn’t be a problem!

Comments

  • Craig says:

    You could have simply moved the index.php file and changed the location URI in the settings panel of the dashboard.

    One should back up regularly but there’s no need to move anything if you’re only changing the slug WP is appearing on.

  • Have your say: