As is known, too many 404 page not found errors can badly affect the user experience and Joomla SEO. As a result, reduced traffic can be expected.
Fortunately, Joomla is a dynamic platform that allows you to create and customize the 404 error pages. There are multiple customizations that you can make to help the visitors in finding the correct destination.
Before starting with the creation of error pages, it should be kept in mind that the templates/system/error.php file is used by Joomla to take care of various HTTP Status errors such as “500 Internal Server” error and “404 Not Found” error. Furthermore, you should remember that error.php file has no relation with Joomla CMS but has several things in relation to the platform. Therefore, you cannot expect a plugin to run on this file.
How to Create a Custom 404 Error Page in Joomla
To create a custom 404 error page in Joomla, you should primarily create an uncategorized “404” article wherein you can add a customized error message along with some navigational links. Some popular websites also add a link back to their website’s homepage.
Next, you should develop and copy the link to the recently created article and click on “Apply”. Once done, you can close the menu editing page after copying the URL information and setting the menu item as “unpublished”. Now, you need to copy the file error.php to the main template directory from the templates/system directory.
Lastly, you have to redirect the 404 Errors to the 404 article. For this, you need to add the following code under the “restricted access” section.
In order to customize the error messages on the 404 error page, you have to use a specific code in the error.php file. The code that should be used is:
In the above-mentioned code, you can customize the message by replacing the “Sorry! That page cannot be found” with any desired message. However, you should make sure that the rest of the code is left unchanged.