Joomla custom 404 error page
404 error (Not found) occurs, when article is deleted, changed its location or visitor mistyped URL. Default Joomla 404 error pages will disappoint your visitors or can be difficult to use in multilanguage sites and manage error text (1.7 and 2.5 versions). In this article I will show, what are the problems in default Joomla error pages, and how to improve them by making custom 404 . Jump to section 3 steps to make custom 404 page
1. Create article called ‘404 error’ or ‘Content not found’ or …really, title is up to you. As well as content, but let me suggest few things what 404 message should contain:
- What happened (article deleted, changed, mistyped address).
- What do next – advise to use search (or include search box in 404 article by pasting
in article content. Of course, you must have Search module published in position Search.
You can also provide e-mail address or link to contact form, if visitor can’t find article.
2. open .htaccess file (it’s on root folder of Joomla installation) and paste
ErrorDocument 404 http://www.yoursite.com/index.php?option=com_content&view=article&id=777
on end of it. Change yousite.com to your actual site (obviously) and 777 to ID of ‘404 article’ you created in previous step.
3. You can skip this, but you should hide 404 page from Google search results by copying
in robots.txt file. It’s also in root of Joomla installation, and also remember change 777 to actual ID.
Plugins for 404 errors
Commercial component– sh404sef for 1.5, 1.6, 1.7 and 2.5. In addition to SEF urls and social media integration, component greatly handles 404 errors – it shows links to articles, which have similar URLs (provided you use SEF URLs). By clicking those similar links, visitor can get article he wanted.
If your budget allows (right now this component costs 39$), sh404sef is great and you might consider using it. If not, use free plugin below or follow 3 steps mentioned in previous paragraphs.
Free plugin for 1.5, 1.7 and 2.5 versions – Error 404 . It does exactly the same as previous 3 steps, but also has option to send e-mail to administrator informing about 404 error. It’s compatible with SEF links, installation is simple so 5 stars to this plugin!
Default Joomla 1.7 & 2.5 error pages
Error page is shown within website’s design, so this step forward from 1.5 Joomla. It contains search box, what is useful. Unfortunately, it’s far from ideal.
First, how to change message? There is no article called 404, no system configuration option ‘change 404 ‘. In template folder you must have error.php file, editing it obviously requires basic PHP/HTML knowledge and FTP access. You could do it, but if your client has no PHP knowledge and access to FTP, he can’t change 404 page without contacting you.
Next, multilanguage 404? Even more PHP knowledge to create error message based on language. Also, every time you change website’s layout, you must change error.php as well.
Default Joomla 1.5 error pages
This is one of the things I hate about 1.5 version – when user stumbles upon 404 error, he gets rather frightening message.
- This red box at first looks like something has gone terribly wrong (seriously, when I started working with Joomla, after getting this error message I was like – geez, I broke something already! After reading message I of course realized that this is just a wrong url.
- It’s out of website’s design, so at first visitor might think, this isn’t website’s error at all (go and restart Internet!). After reading error, he can click hard-to-find-because-it-doesn’t-stand-out-Home-button or click Back on browser. It’s like you were thrown out of shop for going on wrong aisle and had to came back again (maybe this time you’ll be lucky).
If your site has lot of content or you change it often, improving 404 error page is essential. You can do it yourself, you can use free or commercial plugin. Remember – content is king but way you handle ‘Not found error’ is respect to that king.