Change the default Joomla Error template

This is a quick article on what I change the error page for Joomla websites to. I like a clean error page, for a demo visit
  • Applies to Joomla 1.6.x, 1.7.x, 2.5.x

  1. Backup the file \templates\system\error.php
  2. Create a replacement file called error.php including the below code
  3. Change the message "The Page you are looking for..." to what you want.
  4. Change the link "" to the "".
  5. [Optional] If you want the image that creates the shadow you can download it here. I put it in the folder \templates\system\images.
 * @package     Joomla 2.5.x - Clean Error Page
 * @copyright   Copyright (C) 2013 Joel Lipman .Com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt

defined('_JEXEC') or die;
if (!isset($this->error)) {
        $this->error = JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
        $this->debug = false;
//get language and direction
$doc = JFactory::getDocument();
$this->language = $doc->language;
$this->direction = $doc->direction;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>">
        <title><?php echo $this->error->getCode(); ?> - <?php echo $this->title; ?></title>
                .error > span {position:relative;}
                .error > span:before {content:"";position:absolute;top:70%;left:-30px;right:-30px;height:80px;background:url(/templates/system/images/error_shadow.png) no-repeat;background-size:100% 100%;}
                .error {text-shadow:0 -1px 0 rgba(0,0,0,0.9), 0 1px 0 rgba(255,255,255,0.7);font-size:200px;font-weight:700;position:relative;top:50px;}
                h1,h2,h3,h4,h5,h6 {color:#505050;font-weight:400;}
                h1 {line-height:36px;font-size:2em;font-weight:700;}
                .center {text-align:center;}
                body {font:normal 14px/20px Arial, Helvetica, sans-serif;color:#777;}
                .title {margin:20px 0 0;}
                h2 {font-size:24px;line-height:24px;}
                .message {width:400px;margin:20px auto 0;text-align:justify;}
        <div class="center">

                <h1 class="error">
                                <?php echo $this->error->getCode(); ?>
                <h2 class="title"><?php echo $this->error->getMessage(); ?></h2>
                <p class="message">The Page you are looking for no longer exists or another error occurred. <a href="javascript:history.go(-1)">Go back</a>, or head over to <a href="">Joel Lipman .Com</a> to choose a new direction.</p>

  1.  <?php 
  2.  /** 
  3.   * @package     Joomla 2.5.x - Clean Error Page 
  4.   * @copyright   Copyright (C) 2013 Joel Lipman .Com. All rights reserved. 
  5.   * @license     GNU General Public License version 2 or later; see LICENSE.txt 
  6.   */ 
  8.  defined('_JEXEC') or die; 
  9.  if (!isset($this->error)) { 
  10.          $this->error = JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'))
  11.          $this->debug = false
  12.  } 
  13.  //get language and direction 
  14.  $doc = JFactory::getDocument()
  15.  $this->language = $doc->language; 
  16.  $this->direction = $doc->direction; 
  17.  ?> 
  18.  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""> 
  19.  <html xmlns="" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>"> 
  20.  <head> 
  21.          <title><?php echo $this->error->getCode()?> - <?php echo $this->title; ?></title> 
  22.          <style> 
  23.                  .error > span {position:relative;} 
  24.                  .error > span:before {content:"";position:absolute;top:70%;left:-30px;right:-30px;height:80px;background:url(/templates/system/images/error_shadow.png) no-repeat;background-size:100100%;} 
  25.                  .error {text-shadow:0 -1px 0 rgba(0,0,0,0.9), 0 1px 0 rgba(255,255,255,0.7);font-size:200px;font-weight:700;position:relative;top:50px;} 
  26.                  h1,h2,h3,h4,h5,h6 {color:#505050;font-weight:400;} 
  27.                  h1 {line-height:36px;font-size:2em;font-weight:700;} 
  28.                  .center {text-align:center;} 
  29.                  body {font:normal 14px/20px Arial, Helvetica, sans-serif;color:#777;} 
  30.                  .title {margin:20px 0 0;} 
  31.                  h2 {font-size:24px;line-height:24px;} 
  32.                  .message {width:400px;margin:20px auto 0;text-align:justify;} 
  33.          </style> 
  34.  </head> 
  35.  <body> 
  36.          <div class="center"> 
  38.                  <h1 class="error"> 
  39.                          <span> 
  40.                                  <?php echo $this->error->getCode()?> 
  41.                          </span> 
  42.                  </h1> 
  43.                  <h2 class="title"><?php echo $this->error->getMessage()?></h2> 
  44.                  <p class="message">The Page you are looking for no longer exists or another error occurred. <a href="javascript:history.go(-1)">Go back</a>, or head over to <a href="">Joel Lipman .Com</a> to choose a new direction.</p> 
  46.          </div> 
  47.  </body> 
  48.  </html> 

IMPORTANT: After each update of the Joomla CMS, check that this file has not been overwritten as the Joomla update patches often reset this file.

Category: Joomla :: Article: 500

Credit where Credit is Due:

Feel free to copy, redistribute and share this information. All that we ask is that you attribute credit and possibly even a link back to this website as it really helps in our search engine rankings.

Disclaimer: Please note that the information provided on this website is intended for informational purposes only and does not represent a warranty. The opinions expressed are those of the author only. We recommend testing any solutions in a development environment before implementing them in production. The articles are based on our good faith efforts and were current at the time of writing, reflecting our practical experience in a commercial setting.

Thank you for visiting and, as always, we hope this website was of some use to you!

Kind Regards,

Joel Lipman

Related Articles

Joes Revolver Map


Badge - Certified Zoho Creator Associate
Badge - Certified Zoho Creator Associate

Donate & Support

If you like my content, and would like to support this sharing site, feel free to donate using a method below:

Donate to Joel Lipman via PayPal

Donate to Joel Lipman with Bitcoin bc1qf6elrdxc968h0k673l2djc9wrpazhqtxw8qqp4

Donate to Joel Lipman with Ethereum 0xb038962F3809b425D661EF5D22294Cf45E02FebF
© 2024 Joel Lipman .com. All Rights Reserved.