I moved this site from the /blog folder to the root folder recently.
The main reason was to tidy up this domain and, in the process, improve its focus.
That, I hope, will improve the effectiveness of its SEO.
I’ve had this domain for 5 years and during that time I’ve had different folders and pages on it for different products and businesses, so it had all become a bit messy.
Furthermore, this blog, which gets the most traffic on the domain and on which I do the most work, was in a sub-folder.
So moving it up to the root was a bit of a no-brainer.
It’s not a complicated process, but it does require attention to detail, because there’s quite a bit that can go wrong if you’re not careful.
In this example I’ve assumed WordPress was running in the /blog folder on my domain (which it was), but if your WordPress is running in a different folder just substitute that name for /blog.
So here’s what I did:
Before you start
Before you dive in it pays to take some time to research the process and write out a step-by-step plan of the things you need to do.
Every site is different and the process you follow needs to be specific to your site.
So the first thing I did was to set up a test bed by creating a /blog folder on one of my old domains and installing WordPress.
Next I installed and activated plugins that I was using on this site and that rely on or use URLs to do their thing (since the URL of the blog was going to be changing).
This would enable me to check how the move would affect them.
You should also import some posts from an existing blog so you can see whether internal links are affected.
Once everything was set up I then followed the WordPress codex instructions (moving WordPress within your site) and moved the blog to the root folder.
I’ll go through the steps in detail later.
The point of this dry run is to learn what actually happens on your own configuration and prepare the extra steps you will need that aren’t covered in the codex (and quite a few aren’t).
There are a couple of things I discovered immediately as a result of this process:
- The step of updating your Permalinks redirects posts and pages but not archive URLs – category and tag pages, for example. You need to update the .htaccess file with a 301 redirect to ensure all pages are re-directed.
- After moving the WordPress files you’re met with a white screen when you try to go to the Permalinks step in the WordPress codex, and you need to log in again through the new URL. White screens can be alarming – but this one’s no biggie.
Next, and after you’ve gathered all the information, set out a simple step-by-step plan of the things you need to do. Have it printed out beside you and just work your way through.
The process I’ve set out below will be a good starting point.
But all blogs have their own unique characteristics (different plugins, widgets and layouts), so you’ll need to review it carefully to make sure all the steps you need to take for your blog are covered.
Moving your blog to the root folder
Here then, based on the WordPress codex but augmented with what they left out, is the process:
Copy a range of URLs from your existing blog and paste them into a text file. Copy a URL of each type – e.g. a post URL, a page URL, a category page URL, a tag page URL, an archive URL and so on.
Make sure you have a URL of each type.
You’ll need these later in order to test the redirects once you’ve completed the move, so save them somewhere on your machine.
Back up your entire site – database and files.
Check whether you have a .htaccess file in both your /blog folder and root folder.
If you do, make and save copies of both and then combine them by copying the content of each into a new (third) file. Create this file with a text editor.
Save all three files somewhere on your local machine, so you have backups of everything – you’ll need the content of the combined .htaccess file later.
Clear out any files you won’t need in your root folder after you’ve transferred WordPress.
Be sure to clear out index.php or index.html if they exist. You can leave folders (if you’re still using them) and .html or .php files if they have distinct filenames and you still need them.
Log in to your blog
Go to your Settings > General screen and change the URI to the new address in both the WordPress address and Blog address boxes. The address should be the same in both.
Be sure to do this before moving the WordPress files.
Click ‘Save Changes’
Do not try to view your blog now!
Fire up your FTP client.
If you’re still on WordPress 2.X delete the /wp-content/cache folder. Skip this step if you’re on WordPress 3.X
With your FTP client, move the content of your /blog folder (i.e. all files and folders within it) to the root directory.
Do not move the /blog folder itself.
Check your /blog folder and delete any remaining files it contains.
Be sure to leave the empty /blog folder in place.
Return to your WordPress admin area and go to the Settings > Permalinks screen.
At this point you’ll get a white screen.
The address bar in your browser will have the new blog address followed by /wp-login.php and some trailing characters.
Remove the trailing characters to leave your login address and hit
Log in to your blog again and go to the Settings > Permalinks screen.
Check that the Permalink structure is the same as before with only the /blog step removed.
Click ‘Save Changes’
Return to your FTP client and pull up the .htaccess file in your root folder.
Copy the content of the combined .htaccess file you created earlier and paste it into this .htaccess file, being careful not to over-write anything that may already be there.
Paste the combined content immediately under any code that has already been placed there by WordPress.
Add this additional line of code to your new .htaccess file:
redirect 301 /blog/ http://www.yourdomain.com/
Copy that code exactly and replace ‘yourdomain’ with your domain name. If your previous folder was not /blog replace ‘blog’ with your folder’s name.
Be sure to retain the same spacing and all trailing slashes, exactly in the format above.
Save your .htaccess file and, if you’re using Filezilla, click ‘yes’ when it asks if you want to upload the revised file back to the server.
Go to your plugins screen and check any plugins that rely on URLs to do their stuff.
From my experience you will need to change the ‘Path to backup’ path in WP-DBManager:
If you’re using a cache plugin you’ll probably need to change various URLs.
With W3-Total-Cache this is handled semi-automatically – it tells you updates (3 of them) are needed and gives you buttons to click.
If you’re using a Sitemap generator plugin you’ll need to check the path to the sitemap.xml file to make sure it’s still valid.
When you’ve done that be sure to re-build your sitemap.
Google Friend Connect will need to be updated – which you’ll have to do through your Google account and then re-paste the code.
Those are the changes I had to make, but I have no idea what plugins you’re using, so be sure to check them all carefully.
Test the re-directs.
Retrieve the file of original URLs you created earlier and paste them individually into your browser’s address bar to make sure all the re-directs work as they should.
As long as you copied the code I gave you in step 16 correctly there should be no problem here.
With my move I had a problem for a while with the re-direct on my home page because I’d deleted the /blog folder. As soon as I replaced it (empty) everything worked perfectly.
Access your Google Webmaster Tools account (if you’re using GWT) and re-submit your sitemap.
If you’re using Google Custom Search access your GCS screens, update the included sites (to remove the /blog) and re-index your sitemap.
That’s it – you’re all done – congratulations..!
What I then did (although it’s not strictly necessary if your redirects are working properly) was to change my blog URL to the new address wherever I could.
That meant my Twitter, Facebook, LinkedIn and other social networking accounts, my email signatures and so on.
Will the move benefit my SEO? I have no idea.
But the domain is certainly a lot more focused and tidy now.
As a footnote, after re-submitting my sitemap in Google Webmaster Tools all my links disappeared and my indexed pages count dropped to 0.
But they were fully re-indexed and my links were all back again after 4 days, and I suffered no noticeable loss of traffic in the interim.