Creating 404 page for Joomla

Majority of the webmasters would agree to the fact that the default 404 page of Joomla looks really Ugly. Hence, most feel the need of creating a custom 404 error webpage for a Joomla Website.

How to create a Custom Joomla 404 Page ?

It is easy to build a custom 404 page for your Joomla website. Well, before you start with the process, it is suggested to take a backup of your site. Then you should follow the below described procedure.

Step I : Start with creating an article post naming it as Error 404 or anything that you feel suitable for your site. Most individuals would keep that as the title, this is due to the basic fact that the default Joomla page holds the same title. You can add custom text and images to this page similar to the way you would create an article. As a matter of fact, you must try adding content that would inform the visitor about what has actually happened and guiding them with the course of action that they’d have to take. Incase you do not want search engines to crawl and index this page, then you are required to set it as “no index, no follow” in your sites robots text box. This can be found under the Metadata Information.

Step II : You could also create an additional menu and call it as “Error Pages” and link it to the article that you’ve just created. Having done that, you can proceed with publishing the article.

Step III : Find the default error.php file that is created automatically with the installation of Joomla on your web hosting UK server. You can find it within the templates/system/” directory. Having found it, you must create a copy of it and add the copy to the directory for the active template you’re using for your website. Joomla would search for the error.php file within that directory initially before searching it at the default location.

Step IV : Using your preferred text editor, you must open the new error.php file. Then look for the default code as stated below in this file :

Default code in error.php

defined( ‘_JEXEC’ ) or die( ‘Restricted access’ );
?>

and proceed with making amendments to this:

Altered code in error.php

defined( ‘_JEXEC’ ) or die( ‘Restricted access’ );
if (($this->error->code) == ’404′) {
header(‘Location: http://yourdomain.com/404′);
exit;
}
?>

Note : Replace ‘yourdomain.com’ with the post URL that you have just created.

Step V : Once you are done with making these changes, you must Save and upload it back to the server via. FTP. The desination should be the same ie. the template directory. Once done, you must test it in your web browser. If things have turned out as expected then, all the steps have been carried out correctly. But if the custom error page isn’t shown, then you must repeat the steps stated above.

You may wish to refer the below links from the official Joomla Website :

http://docs.joomla.org/Custom_error_pages
http://docs.joomla.org/Tutorial:Create_a_Custom_404_Error_Page

This entry was posted in Industry Knowledge Hub, Other Hosting Services and Related, Tutorials, Web Hosting Articles and tagged , , , . Bookmark the permalink.

Leave a Reply