How to Create a Custom 404 Page in Joomla?

The page not found error is downright irritating and it might bug away visitors and that they could never return to your web site. To scale back the difficulty cause by a 404 error you’ll use a custom 404 error page rather than the boring and useless one. The page might give the required details to guide the lost visitor and ensure they return to your website.

Before you create your own custom 404 page check the subsequent things that you must have on a 404 page.

Search Box– If there’s search option on your web site then you must add it to the 404 page further so the visitor will search what they’re trying to find on your site.

Sitemap link– it’s essential that you simply have link to your sitemap and your homepage therefore the visitors will notice the way to go back to the site and find what they need.

Follow these straightforward steps for designing your custom 404 error page in Joomla! 2.5.
Step 1: You need to create a file and name it error.php and place the file into the main directory of your template that is (/templates/your_template/error.php). Then you have to add the code to the file as give below:

<?php

// no direct access

defined( ‘_JEXEC’ ) or die( ‘Restricted access’ );if ($this->error->getCode()==404) {

echo file_get_contents(‘http://www.example.com/error’);

exit();

}

?>

Make sure that you replace the URL with your web site.

Step 2: Now create a message for the page with the title error or 404 or anything that you simply feel would work. you must place in a category that isn’t directly visible on your website.

You might have seen error or 404 messages on websites like Reddit or Twitter that are quite inventive and you’ll additionally create one thing on those lines to redirect your visitor to a relevant page on your site.

Step 3: Then make a menu hidden menu, one that isn’t published and create an item with the name ‘error’ with an alias of error. If you wish to use another alias then you would required to change the above URL to reflect the same.

Now give the type ‘Single Article’ to it and point it to your ‘Error’ article.

It’s all completed. Now whenever you’ve got a broken link or there’s a wrong link used by a visitor then they might see your custom error page with a catchy message that may redirect them to a correct page rather than the crappy server error that sometimes bugs visitors off.

If you’ve got the other problems after you build a web site or associated with web site hosting then you can refer our WebHosting Blog or post your question in our live chat support and that we would do our greatest to assist you get your website fixed.