Talk

Creating a Custom 404 Error Page

From Joomla! Documentation

The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Bad Advice[edit]

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[edit]

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[edit]

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.