Redirected Old Blogger Posts to WordPress Posts

I spent quite a bit of time just trying to figure out how to redirect my 200-odd old Blogger-created blog posts to their corresponding posts. Before switching hosts last week, I used Blogger to maintain the Palabok blog. A single post would have a URL in the following format:

http://palabok.com/2005/12/topic-title-here.asp
(Yeah, the old host is an ASP/ASP.Net host)

When I started the new WordPress-powered Palabok blog, I chose the following permalink format:

http://palabok.com/salansan/123
(where 123 is the Post ID)

I didn’t know how to use redirects in .htaccess at the time so what I did was use my new host’s cPanel interface to redirect my pages for me. It was a very time consuming procedure, let me tell you. For each page I had, I had to go through two forms just to set up a redirection for it.

Later on I realized that what it was doing was simply adding a simple line for each redirection I created in the .htaccess file on my root folder. Since we had over 200 posts at the time, the resulting file was a bit long. Here is a line of redirection added by cPanel to my .htaccess file:

RedirectMatch permanent ^/2004/09/settling-in.asp$ http://palabok.com/salansan/3

Before I moved from Blogger, Palabok’s Google rank seemed to be quite high because we would consistently come up in the first 20 links on topics that were discussed on the blog. Now, using the same search criteria that used to give us a lot of hits, the site no longer appears on the first 20 links (if at all).

I then decided to change my permalink format hoping that it would improve my ranking with Google again. I used a new format that is similar to the old Blogger-powered post URL but instead of the topic name ending with “.asp”, it now ends with a “/” slash:

http://palabok.com/2005/12/topic-title-here/

My problem afterwards was that I had to delete all the redirections on cPanel and add new redirections to the new permalink one at a time. That was, unless I manipulate the .htaccess file directly instead. I thought it was about time I learn more about .htaccess.

With the help of Google search, I was able to find what I needed to make a simpler and shorter .htaccess script that will just do what I want:

<ifmodule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^([0-9]{4})/([0-9]{1,2})/([^/]+).asp(/[0-9]+)?/?$ http://palabok.com/$1/$2/$3/$4 [R=301,L]
RewriteRule ^salansan/([0-9]{1,3})$ http://palabok.com/index.php?p=$1 [R=301,L]
</ifmodule>

With the above script at the top of my .htaccess file, the server now performs a redirection whenever there is a call for one of my old Blogger-powered posts (those ending with .asp). Since I was at it, I also included a line that will redirect any call to the old permalink format I used when I had set up Palabok (the /salansan/123 formatted one).

So, why did I post this for? Well, just in case somebody else is in the same predicament I was in, that person could just do the same thing I did. Provided that person finds this post, of course.

Advertisements
Published in: on August 18, 2005 at 5:23 pm  Leave a Comment