Migrating a very old Joomla site

Many (many) years ago I set up a web site for the local community centre, using Joomla 2.5.11. Some years after that a section on local history was added, which became popular.

Now the community centre have decided to update their site, not before time, and I have been asked to find a new home for the local history section.

In my day job a web site migration is a multi-year project involving teams on three continents and a budget of millions.

For this migration I have given myself a month, with a team consisting of me and the content creator, and a budget of approximately £60 (domain name registration, SSL certificate, share of hosting package) plus a bottle of single malt for my services.

We agreed to stick with Joomla rather than try to migrate to WordPress, but there remained the challenge of migrating content written for Joomla 2.5.11 to a new instance running 3.9.25.

It seems worth recording the steps taken to do this successfully, as there was a certain amount of searching, trial, and error before I hit on a workable path to migration.

Set up fresh Joomla 3.9.25 installation and back it up

The new hosting package uses cPanel, so installing Joomla is a 1-click operation, plus a wizard to set up some initial configurations (site title, database name, don't install the default content thanks very much, etc).

I took an immediate database backup using phpMyAdmin.

Why? Because the table definitions are different between versions 2.5.11 and 3.9.25

Back up the old Joomla 2.5.11 web site

Using phpMyAdmin again.

Restore selected database tables to the new site

This involved a bit of fiddling. I took the CREATE TABLE statements from the 3.9.25 backup and adjusted them to add missing (deprecated) columns from the 2.5.11 backup.

Perhaps I could have edited the INSERT INTO statement from the 2.5.11 backup to remove the deprecated columns, but that approach looked like it would have taken longer. (Maybe I'll remove those columns later on.)

CREATE TABLE IF NOT EXISTS jos_content (
  id int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  asset_id int(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'FK to the #__assets table.',
  title varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  alias varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '',
  title_alias varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'Deprecated in Joomla! 3.0',
  introtext mediumtext COLLATE utf8mb4_unicode_ci NOT NULL,

    ...

I restored all the customized tables from the old site this way (content, categories, menu, users, content_frontpage)

Trash content that is not part of the new site

Now we had a copy of the entire old site. But we only want the local history section.

Luckily, all these pages had been given a unique category, so it was easy enough in the Joomla administrator area to select the rest of the content and delete it.

The home page ("featured article" in Joomla parlance) had to be changed from the current page (one that was to be trashed) to a new page. Int he Articles section of the admin area, click the star under the Status column to toggle the Featured status.

Fix the home page and menu

The old site had a single main menu containing all the site pages ("articles") in a hierarchy. We wanted to retain only one branch of this, with the top node becoming the home page.

The unwanted menu items were removed using the Joomla administrator area (Menus > Main Menu, then select and trash the unwanted items).

The menu item for the new home page was set to the Default by clicking the star in the Home column.

The parent of this and the nodes immediately beneath it was set to Menu Item Root.

Restore users

After restoring the database table of users, I manually added them to user groups in the Joomla admin area, to preserve or alter their permissions as appropriate for the new site.

Get out of various bear traps

Of course there were things that went wrong.

Unable to edit articles

Trying to save an edited article gave a message Invalid Parent ID.

A quick search revealed that the categories table needed to be rebuilt, and each category opened and saved in the Joomla admin interface, in order for the restored data to "take".

I also rebuilt the menu, to be on the safe side.

Unable to delete articles

There were articles still flagged as checked out in the backup.

Internal server error when setting up SEO

The old site used URL rewriting. Making the setting in the configuration on the new site immediately meant that all menu links went to a 500 internal server error page.

This turned out to need a change to the .htaccess file, which Joomla had created based on the location of the installation in a subfolder of the hosting package. From the point of view of the site as I set it up, the subfolder is the root folder.

So I had to change the directive:

RewriteBase /localhistory

to

RewriteBase /

Still to do...

(at time of writing)

  • set up the new domain
  • set up SSL certificate
  • set up a less boring site template
  • set up redirects from the old site