How to create a custom ‘404 page not found’ page in Joomla

You can use the following instructions to create a custom 404 error page for your Joomla website:

1. Create new article - create new uncategorized article through your Joomla administrative area -> Article manager called 404. You can insert desired text inside it which will be displayed when such error message occurs. When you are ready Save the article. The article will be accessible through a link similar to the following one:

http://www.yourdomain.com/index.php?option=com_content&view=article&id=XX

where XX is the ID of the article. You can save this link because you will need it later.

2. Create new Menu Item - create new Menu Item through Joomla administrative area -> Menu manager called 404 Item (you can use desired name). From the New Menu Item page you have to link this item to the 404 article which you have already created. You can do that by choosing Single article from the Menu Item Type field and after that choosing the article 404 from the Select Article filed on the right side of the page.

3. Copy the default error.php file inside the folder of your current template - you need to copy the default error.php file from the templates/system/ folder inside the folder of the template which you are currently using with your website. For example if you use a template called NewAtomic you will need to copy the error.php file from templates/system/ folder to templates/NewAtomic/. You can do that through your File Manager in cPanel or using an external FTP client.

4. Edit the copied error.php file and place the necessary 404 detection code - you need to edit the error.php file which you have copied inside your template's folder and place the following lines inside it:

  • For Joomla 1.6, 1.7, 2.5, 3.x:

where XX is the ID of the article.

You should place the above code according to your Joomla version at the beginning of the error.php file right after the following lines:

After that save the file and just browse to a nonexistent link from your website such as:

http://www.yourdomain.com/nonexistent-link

and you should see your custom error page.

Don’t forget to clear your Joomla cache through the administrative area in order to see the changes immediately.

Joomla is a powerful software that is easy to work with once you have the right host to support you. Before you lose any more time with the wrong host, check out the SiteGround Joomla hosting offer.