Ultimate NucleusCMS to any blog migration (here, WordPress)

This is not based on migrating the database, but on keeping both systems, Nucleus and the new blogging software working, and the old one’s URLs intact (using some simple .htaccess magic) while adding the new one’s urls.

The downside is that when Nucleus has security holes fixed, you have to keep upgrading it, as well as the new one. This could be solvable by making a static mirror of the nucleus site using, say, wget. Then you could delete the old nucleus installation and just upload the static files in their place – but you would not have the posts in any semantically rich format any more – unless, of course, you backed up the old database before doing this.

This requires that you have “pretty urls” (mod_rewrite using .htaccess) enabled in Nucleus.

  1. Make a new directory for nucleus inside the current blog directory. For me, nucleus resides in /journal, so I moved all of it to /journal/old2008/: while in the directory, do: “mkdir old2008 && mv * old2008”. This will not move any hidden files intact in the old directory, but leave them (most importantly, .htaccess) intact.
  2. Do “chmod u+w config.php“, to make it possible to edit config.php
  3. Edit nucleus config.php to point everything to the new directory you just moved the files to. “/home/username/webroot/journal/nucleus/” becomes “/home/username/webroot/journal/old2008/nucleus/”. Also, add the line in italics below to config.php (this will make nucleus media/image popups work). The change will thus be something like this:
    $CONF['Self'] = "old2008/".$CONF['Self'];
    // main nucleus directory
    $DIR_NUCLEUS = '/home/username/webroot/journal/old2008/nucleus/';
    // path to media dir
    $DIR_MEDIA = '/home/username/webroot/journal/old2008/media/';
    // extra skin files for imported skins
    $DIR_SKINS = '/home/username/webroot/journal/old2008/skins/';
  4. After saving config.php, do “chmod u-w config.php“, to make Nucleus work with its new config file.
  5. Edit the .htaccess that was left in the original blog directory (for me, /journal/.htaccess) so that the ReWriteRules point to the directory where you moved nucleus. That is:
    RewriteRule ^archive-([0-9]+)-([0-9]+)-([0-9]+).php+ index.php?archive=$2-$3&blogid=$1
    RewriteRule ^item-([0-9]+).php+ index.php?itemid=$1
    RewriteRule ^category-([0-9]+).php+ index.php?catid=$1
    RewriteRule ^archivelist-([a-z]+).php+ index.php?archivelist=$1


    RewriteRule ^archive-([0-9]+)-([0-9]+)-([0-9]+).php+ old2008/index.php?archive=$2-$3&blogid=$1
    RewriteRule ^item-([0-9]+).php+ old2008/index.php?itemid=$1
    RewriteRule ^category-([0-9]+).php+ old2008/index.php?catid=$1
    RewriteRule ^archivelist-([a-z]+).php+ old2008/index.php?archivelist=$1

    In addition, I wanted to keep my old RSS feed URL but point it to the new WordPress feed instead:

    RewriteRule ^index.rdf+ ?feed=rss2
  6. Edit your Nucleus frontpage skin at journal/old2008/nucleus so that everything still points to the original directory. That is, since the links probably are relative, you will need to add “../” in front of them.Remember, you don’t want the URLs to change or to have double urls. The old urls will still work since you just fixed the RewriteRules in point 3., above. Only your old blog’s front page will move to journal/old2008/ (or whatever directory you moved your nucleus blog to) on the public web, since it’s old address will be occupied by the new blogging engine’s front page.
  7. Change your Global settings in Nucleus so that everything except “URL of Site” point to the directory where the nucleus blog now lives, in my case, “http://www.pilpi.net/journal/old2008/…”
  8. Install your new blogging system and edit its theme to match your old site. If it’s WordPress, you can also enable pretty URLs for WordPress in Settings -> Permalinks. WordPress is polite enough to just add its rewrite rules to the end of the existing .htaccess.


Original posting and comments at personal site