How to Revert Back to a Previous Version of Joomla?

Sometimes you decide to upgrade your version of Joomla, and then after the upgrade is done, your website becomes completely unusable or some of its features become broken. Why does that happen, and how to revert back to a previous version of Joomla to undo the upgrade.

Why a Joomla upgrade might break your website

There are several reasons that are behind this, and they mainly are:

  • You have modified the core of your Joomla website: Many website owners modify the core of their Joomla website (or have it modified) in order to add some custom functionality. While this can be necessary, it should be avoided when possible. Only modify the core of your Joomla website when there is no other alternative. Note that in most cases there is an alternative! 99% of the very complicated work that we get on Joomla can be done using extensions. We rarely find a need to modify the core. And, in the very rare cases where we do, we try our best to make our changes compatible with future upgrades.
  • You have installed an extension that is not compatible with your current version of Joomla: When you do an upgrade, sometimes a 3rd party extensions can be incompatible with your current version of Joomla, and if this extension is a System plugin that runs on every page, then most likely your page will either show a blank page or will display a fatal error (at best your page will display a warning).

  • You have uploaded the files to the wrong place: A Joomla upgrade usually consists of uploading specific files to specific directories. Sometimes the upgrade can consist of just uploading a couple of files to a couple of directory. What if, for example, you need (as part of the upgrade) to upload index.php to the administrator directory, and instead of uploading that file to the administrator directory, you uploaded it to the root directory of your website. Not a single page on your website will work (the index.php file that is located directly in the root directory of your website is used on every page on the frontend of your Joomla website).

  • You haven’t finished uploading the files, but you thought you did: As stated above, a Joomla upgrade consists of uploading several files. What if the upgrade consisted of uploading 5 files and you uploaded only 4, and what if the file that you missed is used by those other files? At worst, all of your website will stop working and at best, some of your functionality on your website will be broken.

How to revert back to a previous version of Joomla

Once you notice that the upgrade has broken your website, you slap your forehead with your right hand (or left hand, if you’re left handed or ambidextrous), and you whisper “What have I done?”. You start panicking and the first thing on your mind usually is “how can I revert this upgrade?”. Well, the easiest way to revert back to a previous version of Joomla is to just go back to a previous filesystem backup. But even that can be tricky, especially if the upgrade has modified both your file system and your database. So, if you do have backups, then it’s always better, when reverting to a previous filesystem backup, to revert back to a database backup that was generated the same day the filesystem backup (that you’re using) was generated.

But, what if you don’t have any backups?

This is when this can quickly become very challenging. When you uploaded the files, you have erased the previous versions of the files. So, the first thing that you should do is the download the previous Joomla version (the one that you had before the upgrade), and then replace the files that you have already uploaded with the files from this (previous) Joomla version. Once you do that, two things might happen:

  1. Your website will return to its previous working state. (congratulations)
  2. Your website will show different errors. In this case, it’s because the database was updated using that upgrade. You will need to contact Joomla experts at this point because it’ll be really hard to fix these errors without a backup (and you will need programming and MySQL skills to fix them).

So far, we have talked about reverting back to a previous version of Joomla if it’s an upgrade, but what it’s a migration? In this case, there is no other way but to revert to a previous backup (a migration is a destructive process as it consists of recreating the site from scratch), and if you don’t have any previous backup, you will need to contact a Joomla company, such as itoctopus, in order to revert your Joomla website back to an earlier date. We, at itoctopus, are very experienced in Joomla and we are also extremely nice people to work with. Just contact us and we’ll take it from there (don’t worry about our fees – they are really, really reasonable).

Addendum: Some best practices when upgrading your Joomla website or migrating your Joomla website to another version

Here are some best practices when upgrading or migrating to another Joomla version:

  • Backup your database and your filesystem just before doing the upgrade or the migration.
  • Create a copy of your database (using phpMyAdmin) and create a copy of your actual website under an previous directory (so, in other words, you should upload all the files for your website to that previous directory, which should be located directly under the root directory). Change the configuration.php file in your directory to point to the copy of the database (not the original database).

  • Avoid using Akeeba backup. Akeeba backup is one extension that you will only know it’s useless when it’s too late. This is because in order for Akeeba Backup to work, your website must be functional (which defies the whole point). In many cases, people revert back to previous versions of their websites when their websites no longer work.
  • If you have problems with your upgrade/migration, then reverting back simply consists of doing a simple redirect in your .htaccess file to yourjoomlawebsite.com/previous, and that’s it! So, in case you have problems, you need to add the following lines to your .htaccess file:

    rewritecond %{http_host} ^yourjoomlawebsite.com [nc]
    rewriterule ^(.*)$ http://www.yourjoomlawebsite.com/previous/$1 [r=307,nc]

    Once you add the above lines to your .htaccess file, upload it to your website, and your website will now work!

  • Although the website is working, it’s working out of the previous directory. We want to make it work out of the root directory, so here’s why you need to do:

    • Delete the original database, and then re-create the original database from the backup.
    • Delete all the directories in your website’s filesystem (with the exception of the previous directory, of course), and then re-upload them from the backup.
    • Roll back the changes you did on the .htaccess file and then upload it back.
    • Your website should now work!
    • Delete the previous directory, you don’t need it anymore.
    • That’s it!
One Response to “How to Revert Back to a Previous Version of Joomla?”
  1. Comment by Michael McKerracher — October 27, 2021 @ 8:15 am

    An employee of ours updated to joomla 4 probably before we should have. VirtueMart was not compatible and it turned our site into a mess of errors. I was able to revive the site to an extent, where our old Virtuemart database was showing up and we were able to search products on the new joomla 4 template, but the site just isn’t performing properly. when you search up virtuemart products it comes up with a picture but the site looks half-finished. Would love any insight on if this is fixable and what it would take to fix it. Even if we could revert the site back to Joomla 3.9 and have the old virtue mart database work with it. Let us know, Thank you!

Leave a comment