Migrating from BlogEngine.NET to WordPress 4.0 – 2014

Migrating to WordPress

Finally I did it – migrated away from my old BlogEngine.NET blog to WordPress 4.0!

Like most other developers out there, I want to blog…but I don’t… because my blog is old and it sucks.
I have been in this situation for years now – and today I finally migrated – successfully.

The old situation

I have been using BlogEngine.NET for many years and I originally picked it as my engine because I know .NET and it were the first “great” .NET blog engine.
From my research online, it seems that many developers have been falling into this trap too.

Choosing your blog engine based on the technology you know, is not always the best choice. In your head it sounds great, you can tweak it here and there and make just ‘right’. Sadly, chances are that this will never happen, as you pretty much want a blog like all others. You want one that is easy to maintenance and have enough plugins to make you 95% happy.
Let’s face it, your blog is not where you should put your development skills, it should just work and be the latest version when you want to write about something real amazing you have been creating.

Over the years I have created other sites and have been using WordPress. It just works, it auto updates after version 4.0, it have all the plugins you need and the administration is a blast to use. This means it will let me focus on what my blog is actually for – writing interesting stuff, like this post.

Why did it take so long?

As said, I have been in this situation for so many years now, never really got (took) the time to migrate my blog. The main reason has been importing my old posts and not loose Google Juice because the old urls wouldn’t work anymore.

But today I decided that it should be and here is how I did it – put simple.

Migration step by step

12 easy steps to migrate your BlogEngine.NET to WordPress 4.0 anno 2014. It might seem like a lot, but really it’s not that hard, at least not now when you have my list here.

  1. I assume you have a clean and fresh installation of WordPress 4.0+
  2. Copy all the images from your old blog up to the new blog and upload it into /wp-content/uploads/. You need to create the folder “upload”
  3. Export your old BlogEngine.NET blog. Settings -> Import & Export -> Click Export (BlogML)
    1. My BlogML.xml were pretty large, 8 MB, so later on when I wanted to import it, WordPress/PHP could handle it. I discovered, in the BlogEngine.NET adminstration that I had 10.000 spam comments. I thought I might help to delete all of them. So I did, by clicking the “Delete All” button under the “Spam” tab. This helped a lot, as my BlogML.xml were now down to 487 KB.
  4. Make some replacements in the BlogML.xml file (eg the images paths – BlogEngine uses image.axd?picture= re-directs that you can replace with the direct path name you used in point 2)
    1. In the xml file I had absolute urls to images, like http://laumania.net/image.axd?picture=MyImage.png. When I did the replace, I replaced it so all the urls became relative to the root. This means the above sample became, /wp-content/uploads/MyImage.png.
  5. Download this BlogML – Importer plugin from the WordPress plugin repository. Then go to Plugins -> Add New -> Upload Plugin in the WordPress administration and install it. Yes, this plugin is old, but it worked for me here in 2014.
  6. Import your blogML.xml file with the BlogML – Importer.
  7. When it’s done, in the bottom you can download a CSV file with redirects, download it, we need it in a moment.
  8. Now you should have all your posts imported. All tags are gone and all the categories are GUIDs. You need to figure out yourself what you want to do here, as it’s up to you know much time you will spend sorting this out. What I did were deleting all the categories, so all the imported posts got the “Uncategorized” category. I can live with that.
  9. Install the “Redirection” plugin for WordPress, which will help you with your old post urls.
  10. Under the Redirection -> Options you can import the CSV file you downloaded before.
    1. You can choose to import to “Redirection” or “Edit posts”, I picked “Redirection”.
    2. When I imported, I got an error which you need to fix first – Fatal error: Cannot instantiate abstract class Red_FileIO
  11. Now my blog were all imported and all seemed to work.

Now I just need to find a decent theme and install the plugins that takes my blog to where I want it.

Hope this helped somebody out there.

  • fabry19dice

    Thank you for your post it’s very interesting, but i’m following your instructions and when i try to import my BlogML.xml i receive this error
    XPath error in XPath.class.php:1727 In importFromString(): XML error in given string on line 205274 column 8. Reason:No memory

    I use wordpress 4.0.1 and Wamp and PHP 5.5.12.
    Can you Help me??
    Thanks
    Fabrizio

  • Hi Fabrizio

    I can’t remember the extact error message I got, but it were similar to yours and were related to the size of my BlogML file.
    Therefore I made it smaller by deleting spam comments.

    See step 4 in my guide.

    Let’s hope this helps :)

    //Mads

  • fabry19dice

    Thanks for your reply Mads.
    i have only 2 spam comments. I use Disqus.

    My BlogML.xml is 30MB. I changed values of upload_max_filesize in php.ini of Apache with 100MB and add this line in config.php of WordPress in Wamp:
    /**increased the memory limit to 64M*/
    define(‘WP_MEMORY_LIMIT’, ’96M’);
    define( ‘WP_MAX_MEMORY_LIMIT’, ‘256M’);

    But nothing. I don’t understand what means Reason: No Memorry..

    Fabry

  • Ok, then I’m sadly out of suggestions, as I’m not an PHP expert…

    Hope you find a solution and I would be happy if you posted here the solution that works for you :)

  • Fred Mastropasqua

    To fix the break error on Xpath.class.php, replace it with this https://raw.githubusercontent.com/hugokernel/Php.XPath/master/XPath.class.php

  • Fred Mastropasqua
  • Thats awesome Fred!
    Of cause I haven’t tested it, as I’m already on WordPress now, but lets hope someone in the future will benefit of that.

    Thanks for sharing Fred!

  • fabry19dice

    Thanks Fred, I will try.. in this days

  • fabry19dice

    Hi Fred thank for your code.
    I copy your Xpath.class.php and work, but when i import my Blog in format ML i have this situation:
    First Page:
    Assign Authors

    To make it easier for you to edit and save the imported posts and drafts, you may want to change the name of the author of the posts. For example, you may want to import all the entries as admins entries.

    If a new user is created by WordPress, the password will be set, by default, to “changeme”. Quite suggestive, eh? ;)

    if i press SUBMIT i have this error

    Second Page:

    Warning: Invalid argument supplied for foreach() in C:xamppappswordpresshtdocswp-contentpluginsblogml-wordpress-import-masterblogml-importer.php on line 147

    Warning: Invalid argument supplied for foreach() in C:xamppappswordpresshtdocswp-contentpluginsblogml-wordpress-import-masterblogml-importer.php on line 154

    All done. Have fun!

    147 Line in file contains this
    foreach ($_POST[‘user’] as $key => $line) {
    $newname = trim(stripslashes($line));
    if ($newname == ”)
    $newname = ‘left_blank’; //passing author names from step 1 to step 2 is accomplished by using POST. left_blank denotes an empty entry in the form.
    array_push($formnames, “$newname”);
    } // $formnames is the array with the form entered names

    152 foreach ($_POST[‘userselect’] as $user => $key) {
    $selected = trim(stripslashes($key));
    array_push($selectnames, “$selected”);
    }

    What can i do? What means?
    Thanks
    Fabry