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

    becomes:

    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.

Sweet.

For an example, see my last posting on the old blog, in its original url or a posting with <%imagepopup%> used.

Join the Conversation

17 Comments

  1. @Pandemic2: Well, the principle is probably very similar if you want to use this. You can just take steps 1 to 7 no matter which system you are replacing nucleus with. The downside is just that with this, you have to keep upgrading nucleusCMS with security upgrades (in addition to the new system) if you don’t want to get hacked.

    There are also some further tweaks I made after this, i.e. some links and images were still broken, but the fixes were pretty straightforward. If you come across something like this, let me know.

  2. Good info, thanks. It convinced me of keeping my Nucleus installation.
    For one reason, I can’t figure out why, fancyurls never worked with my Nucleus (it does with WordPress). How would the rewrite be without the fancyurl?

  3. I also later removed all unnecessary files from the nucleus directory and blocked all access to the /nucleus/ administration panel by using .htaccess “deny from all”.

  4. 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.

    and always check the .httaacess file, don’t trust wordpress too much. One time i create .httacess using it’s permalink feature, then my previous configuration doesn’t work. i use custom instalation.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.