How to Create a Custom 404 Page in Joomla!


As your website becomes larger, the number of broken URLs on your site pages will increase, making it necessary to guide incoming visitors. By default, Joomla! does not have a 404 page option that can be created and managed – this can affect the user experience and make it frustrating for visitors clicking on broken links to your site via search engines and other blogs.

Having a 404 page will help improve your website for visitors and allow you to point users in the right direction, keeping them where they belong – on your site!

In this guide, we’ll show you how to easily create a custom 404 page.

Creating an article

The first step in creating a 404 page is to create an article. This is done in exactly the same way as it would be when creating a blog post. To create a new article simply click on the Add New Article button in the main Control Panel, or go to Content > Article Manager > New Article and go to Article Manager followed by New.

In the New Article page, give your article the Title “Error 404” and the Alias “404”. The Category can be left as Uncategorised and the remaining settings can be left as the default options.

In the Article Text box you will need to enter the text that you wish to be displayed to visitors on the 404 page. If you have specific design you wish to feature, simply copy and paste the code into the text box.

Editing Metadata

With the article settings configured, the next step is to edit the Metadata. To do this, click on the Metadata Options tab in the right column of the New Article page.

In the drop-down menu next to Robots, select the option for No index, no follow – doing this will prevent the page from being indexed by search engines when spiders crawl your website. Click on Save & Close to confirm the change.

Creating a Hidden Menu

You do not want your 404 page to show up in menus, so it is necessary to create a hidden menu. To do this, go to Menus > Menu Manager and click on New. On the next screen, in the Menu Item Type field enter your Error 404 article; enter any title in the Menu Title field and enter “404” as the Alias.

In Status, make sure that the menu is not published so that it is not displayed.

In the Link field, copy the link to your Notepad – you’ll need it for the next step.

Edit the error.php file

We now need to edit the error.php file so that your site knows to display the custom Error 404 page. Go to the error.php file (templates/YourTemplate/system/error.php) and check that it has the following security code:

defined( '_JEXEC' ) or die( 'Restricted access');

Now, enter one of the following codes:

For Joomla! 2.5:

if ($this->error->getCode() == 404) { header('Location: /PasteYourLinkHere'); exit; }

For Joomla! 3.0/3.1:

if ($this->error->code == 404) { header('Location: /PasteYourLinkHere'); exit; }

Close the file and you’re all done! You can now check out your Error 404 page by entering a broken URL.

Our Recommended Joomla! Web Hosting Provider


Get a 45% Discount by using our link.


A popular Canadian web host which offers a one-click Joomla installation option through the included control panel (cPanel). HostPapa is our recommendation to host a Joomla website.

Leave a Reply

Your email address will not be published. Required fields are marked *