Actions

Talk

Creating a Custom 404 Error Page

From Joomla! Documentation

Revision as of 15:18, 27 June 2012 by Richard McDaniel (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Bad Advice

Following this article's instructions causes all 404 errors to end up as 302 location redirects. This means that broken links aren't correctly reported and causes problems such as search engines continuing to index broken links.

Minor recommendation

As written, the code caused this error "Firefox has detected that the server is redirecting the request for this address in a way that will never complete..." when redirecting things like www.mysite.com/somefolder/non-existent_page.htm


Instead of

if (($this->error->code) == '404') {
header('Location: index.php?option=com_content&view=article&id=75');
exit;
} 

I used this

if (($this->error->code) == '404') {
header('Location: /index.php?option=com_content&view=article&id=75');
exit;
} 

and that resolved the issue.

-Tom Warfield www.warfieldconsulting.com

What If

How should the redirection code be if we have a multi-language Joomla 1.7 installation? That is we will need as many 404 redirections as the number of installed languages.