Thursday, April 02, 2015
Text Size

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.

  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:100% 100%;} 
  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.

Add Comment





Help Develop!

Thank You! :c)

Connect: Google+

Visitors of the World

Latest Posts

  • Basic Android App using Google Maps and Current Location

    • Sat 28-Mar-15
      Hi Vsiqueira, I used to get a similar problem if I switched my android device off and on again.
      Joel L.  
    • Fri 27-Mar-15
      hi, im getting an erro, in the method MyLocation.getL ocation(), return null, how i can resolve ...
    • Wed 25-Mar-15
      Hi Rishikesh, I use a database on a webserver with all the latitudes and longitudes of the points of ...
      Joel L.  
    • Tue 24-Mar-15
      At the starting asa I run the app. I want to show list of garages available near by my current location.
  • JComments 2.3.0 with ReCaptcha in Joomla 2.5.x

    • Mon 23-Mar-15
      Worked like a charm first time! :lol: Getting bored of the spam comments. This should stop them. :P