Migrating from Serendipity (s9y) to WordPress

Max Rydahl Andersen

I migrated this blog from from Serendipity (s9y) to WordPress.

It turned out to be pretty simple to import s9y posts to WordPress with the s9y importer, but making sure the old links to posts and feeds turned out to be a bit trickier.

I found a blog post that outlined how to use .htaccess to solve some of these problems, but it included manually having to figure out which id's that had become skewed during the import process. Luckily the SQL schema of both s9y and WordPress is pretty similar and easy to do queries against to generate matching .htaccess lines.

The following SQL queries is what I used to create a working .htaccess file for my migration, use at your own risk ;)

SQL for posts:

SELECT CONCAT( "RewriteRule ^archives/", s9.id,
"\-.*.html$ /index.php?p=", wp.id, " [L,R=301]" )
FROM `serendipity_entries` s9, wp_posts wp
WHERE wp.id != s9.id
AND wp.post_parent=0
AND s9.title = wp.post_title
ORDER BY s9.id
SQL for category feeds:
SELECT concat("RewriteRule ^feeds/categories/", s9y.categoryid,
 "\-.*.rss$ /index.php?cat=", wp.term_id, "&feed=rss2 [L,R=301]")
FROM `wp_terms` as wp, serendipity_category as s9y
where name = category_name
SQL for category:
SELECT CONCAT( "RewriteRule ^categories/", s9y.categoryid,
 "\-.*$ /index.php?cat=", wp.term_id, "[L,R=301]" )
FROM `wp_terms` AS wp, serendipity_category AS s9y
WHERE name = category_name
Once you have the output from these insert them into the following .htaccess file:
RewriteEngine On
RewriteBase /

## skewed articles [Insert output for Posts]

## categories [Insert output for Categories]

## category feeds [Insert output for Categories feeds]

## handle defaults RewriteRule ^archives/([0-9]+)\-.*.html$ /index.php?p=$1 [L,R=301] RewriteRule ^archives/([0-9]{4,4})/([0-9]{2,2}).*.html$ /index.php?m=$1$2 [L,R=301] RewriteRule ^archive$ / [L,R=301] RewriteRule ^feeds/index.rss2$ /index.php?feed=rss2 [L,R=301] RewriteRule ^feeds/index.rss1$ /index.php?feed=rss [L,R=301] RewriteRule ^feeds/index.rss$ /index.php?feed=rss [L,R=301] RewriteRule ^feeds/index.atom$ /index.php?feed=atom [L,R=301] RewriteRule ^plugin/tag/(.*)$ /index.php?tag=$1 [L,R=301] RewriteRule ^categories/(2)\-.*$ /index.php?cat=3 [L,R=301]
With that in place in the root of your WordPress installation those using your old s9y links should now be redirected automatically to the matching WordPress posts/feeds/categories.

Another useful post I found were about how to move WordPress between domains, which I needed because I intially installed it on wordpress.xam.dk but needed it to end up on blog.xam.dk and apparently WordPress thinks it is a good idea to stored absolute url's in its settings.

Now if I could just find a WordPress theme that were both beautiful, simply and functional...still searching..