Migrating From Wordpress to Habari

/migrating-from-wordpress-to-habari 2009-09-17T18:08:15+01:00

It's taken me a little over a year to put all my soldiers in a row and finally migrate my personal blog from Wordpress to Habari.

This long delay really had nothing to do with Habari or Wordpress, but rather my pedantic desires, constantly changing ideas and the need for me to come up with my own Habari equivalents of Wordpress specific plugins. I also wanted to create my own theme from scratch.

In this post I'll detail the steps I took on the road to migrating from my old Wordpress installation to my nice shiny new Habari installation.

Tidying Up

Over the years I've had various permalink structures and have changed them without too much trouble thanks to the Dean's Permalinks Migration plugin, and this is another one of those occasions. I wanted my new site to have a leaner-and-meaner permalink structure. So the first thing I did was change my permalinks from:
http://colinseymour.co.uk/post-name/ to http://colinseymour.co.uk/post-name. No more www and no more trailing slash. I feel this is now technically more correct as this site is not a sub-domain, hence no www, and each post is not a directory, hence no trailing slash (though I could probably still improve this further).

At the same time I added this "fallback" entry to my .htaccess file...

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^colinseymour.co.uk$ [NC]
RewriteRule ^(.*)$ http://colinseymour.co.uk/$1 [L,R=301]
RewriteCond %{REQUEST_URI} ^(.+)/$
RewriteRule ^(.+)/$  /$1 [R=301,L]

This is a bit of a belt-and-braces approach as the .htaccess rewrite rules would take effect before the Wordpress plugin had a chance, but better safe than sorry. This entry also ensures the redirects continue once I'd switched to Habari.

Plugins and Functionality

Once the permalink changes were in place and I was waiting for Google to do it's magic (so I could verify things were good in Webmaster Tools) I concentrated on the functionality I was using in Wordpress, what I wanted to continue to use, and what Habari plugins I'd need to get this functionality. If you don't already know, Habari works on a very minimalist approach. If you want fancy functionality, you implement it via a plugin. Only the bare essentials that would be used by most users are included in the core software.

Sadly, all my needs and requirements weren't met by the vast collection of plugins available in the habari-extras repository or listed here so I had to whip out NetBeans and Mercurial and get coding.

I'll come back to the list of plugins I ended up creating and using later on, because before I could actually get coding, I needed to set up my "Test and Dev Bed"...

Test and Dev Bed

In order to make my testing and coding life easy and consistent, I set up two development environments: one on my OpenSolaris host at work (which closely mimics my hosting provider) and one on my Mac at home, with my Mercurial repositories (for all my own custom code) stored on the server behind this site. Using local test beds means I'm not held up by network latency, outages or any other remote problems.

I then installed Habari from SVN on both machines and configured a bare installation with no plugins enabled. Once both environments were up and running identically, I set to coding my plugins and theme saving each incremental change into Mercurial.

Plugins Continued...

In the end I ended up coding 8 plugins from scratch and modifying a few others. Where possible, I've fed back my changes directly to the author or directly to the habari-extras repository.

My final list of plugins looks almost* like this...

Plugin notes:
1 - My own port of the WP AudioPlayer plugin.
2 - Provided with core Habari installation.
3 - Available from habari-extras or the distribution directory.
4 - Modified to work with Habari SVN.
5 - This is only temporary as the plugin I created for my archives doesn't scale well and ground to a halt.
6 - This is far more functional than the Slimbox2 plugin in the habari-extras repo and I actually created this long before the slimbox2 plugin appeared in the habari-extras repo.
7 - I've not published the code yet, but it's coming soon.

* I've excluded several hacks that I've implemented as plugins as I'm not really proud of them and don't really want to advertise them as I will NOT be releasing the code into the wild.

Finally, the Migration

With all my plugins created and working as best I could test in my two test beds, and my theme looking good, it was time to take the leap and make the move.

The move itself was quite a quick and painless process which went as follows:

  1. Backed up EVERYTHING!!! (Better safe than sorry)
  2. Renamed index.php and .htaccess by appending .wp - Wordpress is installed in a sub-directory so I needed to keep these files just in case I needed to revert back quickly.
  3. Installed Habari from SVN and configured it, but ONLY enabled the Wordpress Import plugin.
  4. Imported Wordpress into Habari using the Wordpress Import plugin.
  5. Enabled the Habari Media Silo.
  6. Copied the contents of the user/sites/lildude.co.uk/files directory (used by Wordpress) to the user/files directory (used by Habari's Media Silo).
  7. Updated the Habari database so all URLs are correct for Habari and my new permalink structure. This involved...
    • changing all references of colinseymour.co.uk to colinseymour.co.uk
    • changing all references of user/sites/lildude.co.uk/files to user/files so my uploaded files can be found when I finally delete the Wordpress directory structure.

    This was done using phpMySQL using the following update statement:

    update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, ‘old string’, ‘replacement’);

  8. Verified things looked good and appears fully functional.
  9. One by one I then installed and activated each of the plugins I'd decided I needed. All but my own custom archives plugin worked.
  10. Installed and activate my theme and verified it looked and behaved as expected.
  11. Finally, I added a .htaccess rule to only allow my specified IP addresses to access the old Wordpress directory structure (so I could login if I needed to).

And the end result...

Screenshot of ColinSeymour.co.uk running Habari

It's not perfect yet and I'm sure I'll discover more issues, but I'll soon iron out all the niggles as I continue to use Habari on a nearly daily basis.

The whole process was a great way to learn about the inner workings of Habari and how it compares to Wordpress, and I must say I'm impressed. The more I dig around the code, the more I'm impressed. The modularity and OOP principles make developing and troubleshooting so much easier, and the Habari community is friendly and responsive.

If you're considering switching from Wordpress to Habari, or even just giving Habari a go, I couldn't encourage you more. You'll be very impressed.

My next goal is to move this site across and take advantage of Habari's multi-site functionality to host all of my blogs off the same Habari installation.

Copyright © 2005 - 2018 Colin Seymour All rights reserved. Privacy Policy.
Check out the feed if you do the RSS/Atom thing.