Every internet user is aware of the message “Error 404 Page Not Found”. Although people come across this term once in a while, only the developers and a few website owners know what it signifies. The message box appears on the screen when the page requested by the user doesn’t contain any data. The reasons for this might be an error in spelling of the URL, or the page might not be available anymore. Whatever be the reason, these pages can be customized in leading platforms such as WordPress, Drupal and Joomla.
As it is not proper to leave a plain and empty error page, here, we’d like to tell you how to create custom 404 error pages with ease.
Reasons to Create Custom 404 Error Pages
The first reason as to why you should create a custom 404 Error Page is to help the visitors, who have lost their ways, to redirect to their destination. It shouldn’t be done as a favor but as a responsibility of being a website owner.
Apart from it, you can also create and customize this page to redirect the visitor to your website’s navigation page or any other suitable page. A short message instead of the “Error 404” message is appreciated by the visitors because it informs the reason as to why the page is not available. Therefore, every website owner should create and customize this kind of error page.
How to Create 404 Error Pages for WordPress
Starting with the creation and modification of custom 404 Error Pages for the most popular blogging platform, the most preferable technique of customizing WordPress is by using codes. Therefore, in this tutorial, we simply discuss the steps of customizing the 404 Error Page via .htaccess file.
First of all, you should log into the cPanel of your WordPress file and choose the File Manager tab under the Files section. Secondly, go to “Document Root for:” tab and make sure that the Show Hidden Files is selected. Select the tab, if it is not selected by default, and click on “Go”.
Now go to the .htaccess file and choose Edit option. Here, you can find a dialog box popup with a text editor. You can ignore the box at the moment and directly click on “Edit”. You should now enter the customized message by changing the “Page Not Found” in the following code.
You can change the words between the “H1” tag, or even use the static page as a replacement.
Don’t forget to the save the changes. Then, you can see the success message appears.
How to Create 404 Error Pages for Drupal
Drupal is another popular platform for the establishment of websites and blogs. It allows the creation of 404 error pages in a simplified way. As the coding method of creating a 404 page is widely preferred by the developers of Drupal, it has been discussed here.
First of all, you should keep in mind that you need to create a new node and ensure that a PHP code can be entered in the body of the page. Upon checking, you should enter the following code in the new page’s body.
The words and messages for the error page can be changed and decided based on your needs. After entering the above-mentioned code, you should save the new page with a custom URL and customize the CSS accordingly.
Now you have to visit the error reporting menu presented in the settings menu under admin, and modify the default 404 Error Page to “Page Not Found” or any other custom message.
How to Create 404 Error Pages for Joomla
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.
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.