The (almost) complete guide to migrate b2evolution to Wordpress

Posted on October 29, 2007

I’ve decided to change b2evolution blogging platform a while ago, being very annoyed by the lack of new features, comment spam and lack of compatibility with other systems. Simply put, nowadays everybody does Wordpress pluggins that make the blogger life easier, while b2evolution is kind of dead for at least 1 year (INMHO).

The bad news is that if you have an established b2evolution blog it’s quite hard to switch. The good news is that I managed to do about 90% of the migration. Basically right now, the only non-migrated elements are the pictures that I used in the posts and the linkblog (which makes it an “almost” complete migration).

First of all, when I decided that I really have to change the blog platform, I found quite some resources on the procedures - unfortunately all proved wrong or incomplete (this includes non-compatible migration scripts, no documentation available). So here are the steps to migrate from b2evolution (latest versions) to Wordpress (including content migration, URL rewrite to keep the results in Google and related stuff)

NOTE: I’M USING MY BLOG URL AS EXAMPLE, YOU SHOULD CHAGE WWW.ENERGYBYTE.COM TO WHATEVER YOUR DOMAIN IS

1. Backup everything (files and database) and make a fresh Wordpress install. I used a new folder for the wordpress but kept the same database for the ease of the migration. The old installation folder was www.energybyte.com/blogs/ the new one is www.energybyte.com/blog (notice the s missing).

2. The second thing you will have to do once you have the Wordpress running is to migrate the old content to the new platform. I’ve tried every script out there that pretended to make the job, but the only working solution was to convert the old blog content to “Movable type” and then import it into wordpress. The complete procedures on How to Import b2evolution Posts to Wordpress - worked great.

3. Once you have the content migrated, the next step is very important. I’m talking about ensuring that the old links (permalinks) from Google or whatever are still working so people could still find your pages. And also, being able to keep your page rank. So, lets see about the migrating the b2evolution permalinks to Wordpress permalinks using URL rewrite:

- first of all, you have to check if your server supports URL Rewrite (if you are on shared hosting, you should ask your hosting company if Apache Server with mod_rewrite is enabled)

- second, log in to your Wordpress admin account, go to Options and the Permalinks tab, and pick “Custom, specify below” and put /%postname% in the text field near. This will make your new wordpress links look like “http://www.energybyte.com/blog/hello-world”, where hello-world is the name of the post. Probably, to make the change take effect, you will have to create a new file in notepad, call it .htaccess and copy paste there the code that is generated by wordpress at the end of the Permalinks page, usually something like this:
# BEGIN WordPress

RewriteEngine On
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]

# END WordPress

Upload the .htaccess file in the root folder of the Wordpress install.

- redirecting the posts: b2evolution usually makes the URLs something like that: www.energybyte.com/blogs/index.php?title=hello_world&more=1&c=1&tb… and your new blog will make the URL look like http://www.energybyte.com/blog/hello-world. So you will need a Rewrite rule and condition to strip the “title” from the initial URL, change folders and put the title after the /. You will want to do this with a 301 redirect (which tells search engines that the page has moved permanently and doesn’t lose your ranking). Create a new .htaccess file edit it with the code below (you should change “blog” to whatever your new wordpress folder name is) and save it in the root folder of the b2evolution blog.


Options +FollowSymLinks
RewriteEngine On
RewriteCond %{QUERY_STRING} title=([^&]+)
RewriteRule ^index\.php /blog/%1? [r=301,nc]

- redirecting the post (second part). Now, the ugly part from the migration using Movable types is that b2evolution sometimes makes the permalinks different from what you would expect, and the new Wordpress database will have the wrong permalinks in it (which means people will not find your posts) . Basically what you need to do is to update the “post_name” field in the wp_posts table with the records from the post_urltitle field from the evo_categories table. You can do a script, or even manually if there aren’t too many posts.

- redirecting the archives. You will need to migrate an URL like this “www.energybyte.com/blogs/index.php?m=200704” to something like “http://www.energybyte.com/blog/2007/04″. This means stripping whatever is after m=, take the first 4 numbers, add a / then put the next 2 number. This is done by adding a code similar to this one at the .htaccess file saved in the b2evolution root folder:

RewriteCond %{QUERY_STRING} m=([0-9]{4})([0-9]{2})
RewriteRule ^index\.php /blog/%1/%2? [r=301,nc]

- You will also need to redirect the category pages from let’s say “www.energybyte.com/blogs/index.php?cat=38” to “www.energybyte/blog/category/Doing-business”. The bad part here is that the old blog uses number (cat=38) and the new ones the category names. So you will have to manually match the IDs with the category names by looking at the b2evolution database eco_categories table. At this time you will notice that here the categories come from the posts and from the blogroll as well. I’ve decided to sacrifice the blogroll and deleted it from the b2evolution administration, which left me with the clear post categories in the database. Now, I didn’t have so many categories, so instead of doing a php script to replace the ID with the category name and then make a redirect, I choosed to make the redirects manually in the .htaccess file. For the category 38 I’ve added to the file (and for the rest of the entries in the databse as well):

RewriteCond %{QUERY_STRING} cat=38
RewriteRule ^index\.php /blog/category/Doing-business [r=301,nc]

which means I’ve redirected cat 38 to Doing-business - as they showed in the database.

- the last redirect you do, is to redirect www.energybyte.com/blogs/index.php or www.energybyte.com/blogs/ to www.energybyte.com/blog This means 2 more lines in the .htaccess file:

redirect 301 /blogs/index.php http://www.energybyte.com/blog/index.php
redirect 301 /blogs/ http://www.energybyte.com/blog/index.php

Note: by cutting index.php from the above redirects, I’ve copied the “media” folder from b2evolution to the root of the Wordpress - and got the pictures to show in the new blog

Right now, we are more or less migrated. You need to pick a new wordpress template, then don’t forget to add the affiliate links from the old one and the Google analytics or whatever you use for tracking. The only thing that is lost (besides the linkblog that I deliberately killed) are the pictures you embedded in the posts. Actually the pictures are not lost, but they are pointing to the old location that is now URL redirected. If you have only few pictures, probably you could re-upload them to the new blog, if there are many, probably you will have to make a script to replace the picture links in the database to the new location.

- Test, test, test. Make searches on Google that will return results from your blog and see if they work. Then, test, test, test!

PS (1): if these steps do not work, use the BACKUPS!!

PS (2): thank you to my friend Beje for helping me out with the URL rewrites and many other advices lately

Share/Save/Bookmark

Related posts

» Filed Under Web Beginner Tags: Tags:, ,

Comments

3 Responses to “The (almost) complete guide to migrate b2evolution to Wordpress”

  1. Easier to read the Small Business Entrepreneur blog : Small Business Entrepreneur blog on November 8th, 2007 8:43 pm

    [...] layout of the blog to something that I find much more easy to read. It was quite a lot of work to migrate the old b2evolution blog to Wordpress but should make your reading a more pleasant [...]

  2. Dave Atkins on November 13th, 2007 4:41 pm

    Thanks for this…I have run into the same issue. 1 1/2 years ago b2evolution seemed like a good idea. But they are dead in the water and wordpress has like 10,000 themes and current plugins and is easy to work with and amazingly well-documented. So I will be using your tutorial very soon…

  3. E. I. Sanchez on November 20th, 2007 8:09 am

    Thanks a lot for sharing the .htaccess code. I’ve used it to move my blog from one directory to the root folder. It works great.

    Edgar.

Leave a Reply




  • Archives