Users Online

We have 114 guests online
Custom 404 page in Joomla 1.5 PDF Print E-mail
Written by Zack MIlls   
Thursday, 07 January 2010 09:20

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=91');
exit;
}
if (($this->error->code) == '404')
{
header('Location: ' . $this->baseurl .'index.php?option=com_content&view=article&id=91');
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.

 

 

 

Last Updated on Thursday, 14 January 2010 09:35