Teneo !!!

Aaron’s blog on Networking, and Enterprise Technology

Redirecting WordPress to Liferay Blogs

I love WordPress.  I really do.  If nothing else, I love the statistics that WordPress gives me per post.  However, my primary move to another site is simply because I want one integrated site, instead of maintaining two individual ones.

So, being that Liferay is my choice, and I don’t want to lose have any broken links from Google or other sites.

So, the biggest challenge?  Liferay blogs do not maintain the same URL style as WordPress.  So, how do you redirect WordPress entries to Liferay entries easily?

First, you must use Apache HTTP server as a front-end to your Liferay system (that should have been your first choice anyway, right?).  Then, you just use modrewrite and use a regular expression pattern.

Next, you would use the WordPress Importer for Liferay.  You would install it as another portlet.  Once installed, choose the “configuration” of the portlet to choose what you want imported (pages, categories, blog entries, etc).  Once the import is complete, you have your blogs.

But, not so fast.  If you choose to redirect your existing WordPress blogs to Liferay, you will end up with lots of 404 errors (page cannot be found).  That’s because the URL is different.

WordPress will send over /year/month/day/title (i.e. 2011/02/16/title-of-entry).

Liferay expects /-/blogs/title-of-entry

So, using modrewrite, I used the following pattern

RewriteRule ^/[0-9]+/[0-9]+/[0-9]+/(.*)?$ blog/-/blogs/$1 [R=301,NC,L]

This means, it will strip the year/month/day, and add the title.  The R=301 means permanent redirect, NC means not-case-sensitive, and the L means this is the last rule to execute.  Keep in mind, that I’m using “blog” first, before “/-/blogs”, because that is the page I use for my blogs.  Change to fit your needs.

I am still struggling with importing comments, but that should be rectified shortly.  Even if I have to wait for Liferay version 6.1.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: