Redirecting a WordPress blog using .htaccess

I recently moved my WordPress blog from being self hosted to wordpress.com. The transfer was easy and straightforward. I simply upgraded the original blog to WordPress 2.7 then ran an export followed by an import into the new blog. This uses the WordPress eXtended RSS (WXR) format.

WordPress.com allows me to use my own domain name (blog.drewery.net) but doesn’t let me use a subfolder structure as I did with my original blog (www.drewery.net/blog). This presented a challenge for my existing Google rankings with links to the old location. The solution came from Chris Himsworth, a developer that I work with, in the form of a custom .htaccess file. The file sits in the location of the original blog, parses the URL then redirects to the new location appending part of the original path. By using a 301 permamanet redirect Google then updates the links. The file is below:

Like this:

Related

Responses

[…] OK, as far as changes here, I am going to move my site from the /blog to the main index. Yes, I know I’ll screw up all the pages in Google for a few hours, but thank goodness for redirection (using Apache htaccess.) […]