|
Friday, 15 May 2009 22:04 |
|
A volunteer for Dogs Aid Animal Sanctuary where my wife works spotted this really cute 404 redirect page over at smartdestinations.com and we wanted to get something similar for the Dogs Aid site. We contacted smartdestinations.com for permission to use the image and they very kindly obliged (thanks guys!), but then I realised that there's no easy way to change the standard 404 error. Thanks to jgcabs over at the joomla forums I found this quick & easy hack to the standard fugly Joomla 404 error screen.
Basically it boils down to creating a template document and then adding a meta tag to templates/system/error.php forcing the page to refresh to that template, just inside the <head> tags. See the 3rd last line of the extract below: <?php /** * @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. * @license GNU/GPL, see LICENSE.php * Joomla! is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. */
// no direct access defined( '_JEXEC' ) or die( 'Restricted access' ); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="< ?php echo $this->direction; ?>"> <head> <title><?php echo $this->error->code ?> - <?php echo $this->title; ?></title> <meta HTTP-EQUIV="REFRESH" content="0; url=useful-info/404-page-not-found"> <link rel="stylesheet" href="/<?php echo $this->baseurl; ?>/templates/system/css/error.css" type="text/css" /> </head> There is a brief flash of the nasty Joomla 404 page before the page reloads but its good enough for what I want. See for yourself: www.DogsAid.com/nonExistantPage |