When I switched from Blogger to Wordpress I had to deal with the problem of how to deal with the old pages.
Blogger style of archiving was static. That means that for every post you created, the Blogger system created a static HTML page.
Wordpress on the other side creates pages dynamically, meaning that there is no .html file whatsoever, the page is created on the fly whenever you request it. A change in the database automatically reflects on the page.
Now, the problem is, the address of the new pages doesn’t match the address of the old ones.
While old posts where in URLs like this
http://www.z-oc.com/blog/2006/09/food-links.html
the new posts where called through PHP queries like this
http://www.z-oc.com/blog/2006/09/food-links
But, as long as the post slug is the exact name of the blogger page (without the .html extension) putting the following rule on your .htaccess file should do the trick.
RewriteRule ^(.*)\.html$ http://www.site.com/$1 [R=301,L]
This rule will simple redirect the html page to the new address that is exactly the same, but without the .html extension.
Keep in mind though, that this will redirect all pages in your site that end with and .html extension, so take care if you have some .html files around.
You can apply this rule on a per-directory basis or you can put aditiona rules to take care of those in particular.
This way of redirecting is particularly good for SEO, because search engines will be notified that the page was permanently moved, helping them to properly index you site.






















9 Comments
Great trick! And this is the same trick used by the cache system in the Ruby on Rails framework. The cache system intercept the request, capture the renderized page and record with the same path and the same name a page with .html in the end. And then, the Apache web server returns this new page for the subsequent request, without your database ever noticing it. The performance gain astonish me.
Nice, Fabio, I didn’t know that.
Can you share numbers about the performace gain?
The answer is: it depends. Any other answer would be a great mistake. It depend how complex is your page, if it do queries on your database and how powerful is your server. For me, in my specific case and in my specific machine, the gain is something between 10x and 40x. My recommendation: for any real application, you MUST turn on the cache system. The Ruby is a interpreted language, and because of this it suffer from performance problems.
Nice overview, thanks for sharing the data.
Great tip! I could see this being very useful for anyone transitioning from Blogger to Wordpress. I like.
Thanks.
Thanks Ryan, and thanks for featuring this post on your blog.
actually just putting the rewrite for the HTML won’t work. because while importing from blogger to wordpress, wordpress changes the the post slugs for certain post hence your permalinks also change. I have listed a workaround on my blog post, you’ll need to modify the blogger.php importer source code and add a extra line to import the post slugs correctly.
@Arpit Jacob – You are right, I do mentioned that the post slugs have to be the same. Nice to have your solution to make it happen.
Trackbacks