Templates

A 404 page worth landing on

A 404 page worth landing on

The default Joomla error page tells a visitor they have failed. Ten minutes of work turns it into something that sends them where they were going.

Every site gets 404s: old links, typos, a page you removed two years ago that someone still has bookmarked. The question is what happens next.

Where the error page lives

Joomla renders errors through error.php in your template folder. It is a normal PHP file with the error object available, so you can branch on the code:

$code = (int) $this->error->getCode();

Write your own copy for 404, 403 and 500, rather than showing the same generic message for all three. A visitor who hit a permissions error needs different advice than one who mistyped a URL.

If your template does not have an error.php, copy the one from Cassiopeia into your template folder and start from there.

What to put on it

  • Say what happened in plain language. Not "HTTP Error 404 Not Found".
  • Keep the header and navigation. A 404 stripped of the menu is a dead end.
  • Add the search box. On a content-heavy site it is the single most useful thing on the page.
  • One or two links to where people usually want to go.
  • Keep the site's design. An unstyled error page reads like the site is broken, not like the link was.

Then actually fix the links

A good error page is a safety net, not a solution. Enable the System - Redirect plugin and Joomla starts logging every 404 into the Redirect component, with the URL that was requested.

Check that list every few weeks. Most of it is bots probing for WordPress files and can be ignored. What is left is real: a link you broke, a URL a partner site got wrong, a page that moved. Point each one at the right place and it stops being a 404 at all.

One thing to get right

Whatever you build, make sure it still answers with a 404 status. A pretty error page that returns 200 tells search engines the page exists, and they will keep it in the index forever.

Stuck on something else?

Doctor Joomla is a project of Cloudfaction, a Dutch agency building and maintaining Joomla sites since 1999. The articles are made with the help of AI, so tell us if something does not match your screen. Mail info@cloudfaction.nl if you want someone to look at yours.

Rather have someone look at it

Doctor Joomla is a Cloudfaction project.

A Dutch agency that has been building and running Joomla sites since 1999. If your site needs more than an article can fix, get in touch.