Joomla to Wordpress redirections

| 🤔 | 👍 | 👎 |

There are some good plugins to export Joomla content to WordPress. However, the free version does not rewrite the URIs. It is quite simple to read the Joomla database and generates a bunch of Apache Redirect directives.

As far as I understood, the URI of a post in Joomla is $pathOfMenu/$slugOfPost where $pathOfMenu is the path of the menu most specific menu associated with a category of the post.

The relevant SQL tables are:

  • joomla_categories for the categories;

  • joomla_menu for the menus;

  • joomla_content for the posts.

For each post, we can generate the an Apache Redirect directive as:

joomla_uri = "/" + menu_path + slug
wordpress_uri = row[:pub].strftime("/%Y/%m/%d/") + row[:alias] + "/"
puts ("RedirectPermanent "+joomla_uri + " " + wordpress_uri)

Get the code.