Move your blog and retain Google rankings

After my small firewall problem, I began looking for ways to increase my Google ranking back to where it was earlier in the year. In searching for solutions to my original problem, it was suggested that my site would be a lot more efficient if the root of the website ( was the opening page, instead of redirecting to I set out trying to have the blog appear to be at the root of the site instead of in a folder and in the process came across this article on WordPress about giving WordPress its own directory.

This is great for accessing the website, but if you’ve built up Google rankings over an amount of time, you will lose those rankings if you leave it at that. My problem was that Google had indexed my site with the folder /blog/ before each entry. Without changing those, people would get a 404 error and not make it to the proper page. That would not by good for traffic and rankings.

My solution was to use a mod_rewrite to redirect all traffic with /blog/ to the root of the site. To do this, i added a function to the .htaccess file on the root of my server. This file affects the behaviour of your webserver and is available from nearly all web hosts. If your host doesn’t provide access to it, you may want to look at a new host.

To direct all traffic, I added this function to the first line of my .htaccess file:

RewriteEngine On
RewriteRule ^blog/?(.*) /$1 [R=301,L]

What this bit of code does is turn all URLs with /blog/ in them into URLs in the root of the website. You can see this in action if you go to and watch the address change to The R=301 portion of the code at the end means that Google and other spiders visiting the site will know that the page they were originally accessing has now permanently moved to a new location. This will cause Google to transfer the PageRank of the original page to the new one, and thus, your website is saved.
[tags]blog, website, Google, SEO, Apache, rankings[/tags]

Leave a Reply

Your email address will not be published. Required fields are marked *