Using Joomla custom 404 page to improve website look and feel

Table of Contents

What are Joomla 404 errors? They are missing files or broken links on the website.

What happens when users see a 404 error? They simply exit from the website, which means both your business and SEO ranking would be adversely affected.

What can you do to prevent this? Don’t worry. Joomla provides a feature to create a custom 404 page. This page allows users and search engines to access other pages on the site with the provided links.

How do we know this? Because at 1onlyhost, we often get requests from our customers to create Joomla custom 404 page as part of our Server Management Services.

Today, we shall explain how 1onlyhost Support Engineers create a custom 404 page in Joomla.



How we create a custom 404 page

By default, website applications come with predefined templates for error pages.

However, every website owner would like to create uniqueness in their pages. In the same way, site owners want to make their own error pages with options to show custom images, links. The default 404 page pops up when the user lands upon a broken link or non-existing file. When this happens, the user will consider the site as down and stop surfing the site. This, of course, can affect your business.

Creating a custom 404-page will prevent this as users and search engines can follow the directions mentioned in the error messages. This will prevent the customers from leaving the site.

Now, we’ll see how our Support Engineers create a Joomla custom 404 page.

1. Initially, we login to the Joomla admin panel and create an Uncategorized ‘404’ Article to build a custom 404 page. For that, we click on Content > Articles > Add New Articles and we fill the following fields too.

  1. Title
  2. Alias
  3. Category
  4. Article Text

2. Then we create a Hidden Menu via Menus > System Menu > Add New Menu Item.

3. Then we select Menu Item Type as Article. A link will automatically be generated here and we copy the link.

4. After that, we edit the error.php in templates/YourTemplate/system/ or templates/YourTemplate/ and add the previously copied Link to it.

Normally, many customers use the below code:

defined('_JEXEC') or die;
if (($this->error->getCode()) == '404') {
header('Location: /index.php?option=com_content&view=article&id=999');

However,  while using this code the browser still gets a 200-header response code and confuses the search engine on whether or not the website page exists.

Therefore, we always use a better code to create a custom 404 page as follows.

  defined('_JEXEC') or die;
  if (($this->error->getCode()) == '404') {
  header("HTTP/1.0 404 Not Found");
  echo file_get_contents(JURI::root().'index.php?option=com_content&view=article&id=#');

Here, we replace the location information with previously copied Link instead of index.php?option=com_content&view=article&id=#

This code helps to use the same URL and retrieve the content of a 404 page.

5. At last, we save the file and test the 404 custom page.


How to fix 404 pages and broken links on a website

If you have a broken link on your site, the custom 404 page helps to prevent the customer from knowing it.  However, there can be cases where it does not work correctly.

Now, let’s see how our Support Engineers fix this error.

1. Initially, we find broken links on the website by using the Google Search Console.

2. Then we use Joomla’s Redirects Component option for redirecting the broken links to working pages.

Or sometimes, we use 301 redirects for broken links in .htaccess

To redirect all pages from the old category to another, we add the following rule to .htaccess.

RewriteRule ^old-category/(.*)$ /new-category/$1 [R=301,L]

That’s it.


[Having difficulty in creating Joomla custom 404 page? We’ll fix it for you.] 



In short, creating Joomla custom 404 page will be useful for both SEO ranking and website users. Today, we saw how our Support Engineers created a custom 404 page in Joomla and fixed related errors.

Leave a Comment

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

Social Share


Cheapest Web Hosting

Fasters Web Hosting Promo
Scroll to Top

Launch your Website at RS599

Create a professional website yourself with our domain hosting combo. Get Extra benefits at this Year end Sale with 10% OFF and Enjoy Amazing Deels on Shared Hosting!

Starting at Only RS599/Year

Year End Sale


Use Code STARTBIZ at Checkout.

Create an earning opportunity with A Web Hosting Business

Become reseller and start reselling domains, web hosting, ssl certificates and More.

45% OFF

Starting at RS399/Month


Use coupon: at the checkout.