Custom 404 page in Joomla 1.5


Joomla 1.5 has a default 404 error page which is devoid of the main website theme. It looks something like this:

404_error



In SEO perspective, the website should have a 404 error page with proper links to the site. According to Google SEO guide, avoid using a design for your 404 pages that isn’t consistent with the rest of your site.

To change the default 404 error page in Joomla 1.5 is quite easy. Just follow these easy steps:

Create a normal article with some message to the users who have arrived on the error page. Publish this article as a menu item and grab the URL for the article. It will be like:

http://www.joomla.in/index.php?option=com_content&view=article&id=122

Now you need to edit the file which contains the code for 404 error page in Joomla. Open the file templates/system/error.php in any editor. Just below this line: defined( ‘_JEXEC’ ) or die( ‘Restricted access’ ); add the following code:

if (($this->error->code) == ’404′) {
header(‘Location: ‘ . $this->baseurl .’index.php?option=com_content&view=article&id=122′);
exit;
}
?>


Replace the old error.php file with this one.

Now you can open any non-existent URL on your website like http://www.domainname.com/non-existent-url.html and you will find that the custom error page has opened.

  • Pingback: pligg.com

  • http://www.webmasterclip.com Edward.H

    Many thanks for your useful tips, a link of this article has been submitted to WebmasterClip dot com in order to share it with more ppl.

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.