How to Create a Custom Error Page on Joomla

How to Create a Custom Error Page on Joomla thumbnail
A custom 404 page that matches your site design can keep vistors on your website.

Joomla is a powerful content management system designed for the easy management of small and large websites. A 404 error occurs when a visitor accesses a part of your website that no longer exists or has been moved or types the wrong address in the URL bar. Website visitors who reach a 404 page are likely to leave the page unless the page directs them to some sort of action and entices them to stay on the site. Fortunately, Joomla provides an easy method for setting up a custom 404 page that can be designed to help you retain visitors to your site.

Instructions

    • 1

      Open up your Joomla administrator back end by typing in your user name and password.

    • 2

      Navigate to the articles section by scrolling over the "Content" button and hitting the "Article Manager" button.

    • 3

      Create a new article with the information that you want to be displayed on the custom 404 page. Recommendations include a brief apology, an email address for the visitor to contact you about the problem and a call to action to other parts of your site.

    • 4

      Save the newly created page with the title and alias reading 404 and place it as an uncategorized article.

    • 5

      Create a new menu labeled "404 menu."

    • 6

      Open a new link in the 404 menu to the article you just created. Click "New," "Internal link," then "Articles" and "Article layout." Label the link "404" and save; do not publish this link.

    • 7

      Copy the link information provided next to the link name in the editing area and paste it into a blank word processing editor.

    • 8

      Upload a copy of the Joomla php file labeled error.php to the template directory of the current template you are using. This file is located in the Joomla installation package and will be under the subfolder templates/system. For instance, if you are using the rhuk_milkyway template, upload the file to templates/rhuk_milkyway.

    • 9

      Edit the error.php page that you just uploaded to your desired template folder with the following code after the line that says "restricted access."

      if (($this->error->code) == '404') {

      header('Location: insert relative URL 404 link here');

      exit;

      }

      Remember to copy and paste the link you created when making the 404 menu link into this code. For instance, if your link read: index.php?option=com_content&view=article&id=102

      Then the code you would paste would be:

      if (($this->error->code) == '404') {

      header('Location: index.php?option=com_content&view=article&id=102');

      exit;

      }

Tips & Warnings

  • Test your 404 page to ensure its working properly. You can do this by typing in your Web address plus random characters to get the 404 page to display.

Related Searches:

References

  • Photo Credit Comstock/Comstock/Getty Images

Comments

You May Also Like

Related Ads

Featured