Eran Kampf
Eran Kampf
5 min read

Migrating from dasBlog to WordPress

I’ve recently decided to move my blog from dasBlog to WordPress. The reason for this move is mainly because dasBlog really lacked several features that were important for me and I found WordPress to be much more mature platform with a wide community support.

Moving the blog to WordPress turns out to be not as complex as I thought it would. However there are some pitfalls that are important to avoid in order for the process to really be as quick and simple as possible.

When moving our blog we have two main tasks: migrate all the blog’s data (post’s etc.) and ensure that the old blog redirects all calls to the new blog so that we don’t loose search engine links\ranking and confuse readers.

Migrating Blog Data

WordPress does not support importing from dasBlog out of the box and there’s no available plugin that does that. The best way I could find to migrate the data to WordPress is to use RSS import. The only downside here is that comments will not get imported 🙁

In order to migrate dasBlog posts to WordPress using RSS perform the following:

  1. Setup dasBlog’s RSS to contain all your data. On dasBlog’s configurations page, under Syndication Settings, increase the number of items in your RSS feed to cover all posts.
    image Also, turn off FeedBurner support so that when trying to access dasBlog’s RSS feed it will not redirect you to FeedBurner.
  2. Disable Aggregator Bugging. dasBlog can add an image to your RSS item that is used to gather feed usage statistics. You don’t want those images to be part of your WordPress posts.
    To disable feed bugging simply go to the dasBlog configuration screen and uncheck the Enable Webbugs for RSS checkbox in the Service Settings section:
    image
  3. Save the RSS as a file. Load the RSS into your browser by clicking on the RSS icon on your blog’s home page or by navigating to http://<blog url>/SyndicationService.asmx/GetRss. Save the displayed XML to a text file on your local drive.
  4. Fix content formatting in the RSS. You have to remove end-of-line characters from the file, otherwise they will be transformed by WordPress during import to line breaks that will mess up your posts layout:
  5. Open the file in Microsoft Word, press CTRL+H to open the Find and Replace dialog.
    Click on More->Special Characters->Paragraph Character. Replace it with nothing (an empty string).
  6. Replace all double spaces with one space character.
  7. Import the file to WordPress. In the WordPress Admin Dashboard go to Manage->Import (or navigate directly to http://<blog url>/wp-admin/import.php). Click the RSS link and browse for the RSS file you just edited. Click Upload file and import button to import your content to WordPress.

Redirect Requests from dasBlog to WordPress

If you’ve been using your blog post title for your post’s permalink than you’re going to have a relatively easy job redirecting all the requests made directly to a post on your dasBlog blog to their new location on WordPress (some coding is required though). Handling the other pages – archive, date and category pages – is a bit more complicated.

First, configure WordPress’s permalinks to use the post’s title like dasBlog. In the WordPress Admin Dashboard go to Settings->Permalinks and choose the Day and name option so that your permalinks will look as follows : http:// <blog domain> /2008/08/04/sample-post/

Now we have to redirect the requests from the old blog to WordPress. I couldn’t find a way to perform this without editing dasBlog’s source code. To be honest, I’ve been running my own customized version of dasBlog for a while now so I’ve had the code ready for use and I didn’t invest much time in looking for alternatives.
In the newtelligence.DasBlog.Web.Core project, open SharedBasePage.cs and add the following code snippet at the end of the SetupPage method:

// *** Redirect to WordPress
string redirectUrl = "http://<blog homepage>.com/";
if (!this.IsAggregatedView)
{
    // We're looking at an indevidual post so we can redirect directly to
    // that post's new location
    Entry entry = DataService.GetEntry(weblogEntryId);

    redirectUrl = string.Format("http://<your blog>/{0}/{1}/{2}/{3}/",
        entry.CreatedUtc.Year,
        entry.CreatedUtc.Month,
        entry.CreatedUtc.Day,
        entry.CompressedTitleUnique.Replace('+', '-'));
}
else
{
    if (Request.QueryString["category"] != null)
    {
        // We're in a category page
        redirectUrl = string.Format("http://<your blog>/redirectFromDasBlog/category/{0}", this.CategoryName);
    }
    if (Request.QueryString["date"] != null)
    {
        redirectUrl = string.Format("http://<your blog>/{0}/{1}/{2}/",
            DayUtc.Year.ToString(),
            DayUtc.Month.ToString("d2"),
            DayUtc.Day.ToString("d2"));
    }
    else if (Request.QueryString["month"] != null)
    {
        redirectUrl = string.Format("http://<your blog>/{0}/{1}/",
            Month.Year.ToString(),
            Month.Month.ToString("d2"));
    }
}
this.Response.StatusCode = 301;
this.Response.Status = "301 Moved Permanently";
this.Response.RedirectLocation = redirectUrl;
this.Response.End();

Compile dasBlog and then replace newtelligence.DasBlog.Web.Core on your dasBlog’s bin folder with the modified version.

The snippets redirects requests to blog posts and archive pages (day pages and month pages) to their new destination on WordPress using permanent redirect status code (301).
Category pages cannot be handles automatically as, when moving to WordPress, you will probably play around with the category hierarchies, names and slug.
Therefore, the code builds a category URL that points to the WordPress blog and guaranteed to get a 404 error. We can track 404 hits on WordPress and manually configure where to direct them…

Track and redirect 404 requests on WordPress. A WordPress plugin, called Redirection, allows you to track 404 errors and manage their permanent (301) redirections:

Redirection is a WordPress plugin to manage 301 redirections, keep track of 404 errors, and generally tidy up any loose ends your site may have. This is particularly useful if you are migrating pages from an old website, or are changing the directory of your WordPress installation.

Install the plugin and then you can go to Manage->Redirection on the WordPress Admin Dashboard and manage redirections from the fake URLs created by the code we added to dasBlog to real destinations on your new WordPress blog.

That’s it! If you’ve reached this far you’re covered…
All the posts have moved to their new WordPress location and all links are correctly forworded to the new location. As mentioned earlier, unfortunately, the only thing left out are the blog comments.
If you know of a way to get the comments migrated to WordPress too please do tell…