Latest

Archive

Community news

C++

Communities and Content

Databases

Editorials

Emacs

General

HTML

Java

Notices

PHP

XML

Apache

C++

Database

General

HTML

Java

Javascript

Linux

Object oriented programming

Open source

Perl

PHP

Python

Ruby

SOAP

XML

Suggest a link

Advertise on zez

Contribute

Contact us

About zez


Missing Documents: How to make 404 messages friendlier with Apache



When someone comes to a 404 document, especially the unfriendly Apache version, they might give up trying to visit you. Therefore it is paramount that you have some measures at hand.


How not to do it.
"In 1999, the incidence of dead link sites was 5.7%. In round numbers that means for every 19 links you click online, one won't work. The 1999 prevalence was 28.5% -- that is just under one in three web pages contained a dead link." All Things Web, Terry Sullivan

That's up 10% since 1998. Or 5% every year, which, if it holds true still, means 33% of all web pages today have one or more broken links.

The first thing you should do is configure Apache to serve a customized 404 document. This is done either in the server configuration, the virtual host, PR directory or in the .htaccess file. What you need to do is add the following directive into the selected configuration:

ErrorDocument 404 URL

The URL can be "http://somehost.somewhere.com/", "/path/to/document.html", "/path/to/script.php" or "Plain text". You should use a path, since the error code will be propagated to the client, whomever that might be. If you use an URL a redirect will be sent, and that isn't the message you would like to send people.

You can send other error codes as well, 401 "Authorization required", for example, look up more information about HTTP error codes, client errors and server errors. A 401 should never be redirected because the client will not know that it should present the user with an authorization box.

I suggest you create a php file (or perl file) which will handle your 404 errors. That script should incorporate the same look and feel of your site, but it should also inform the user about the problem and present the user with solutions, which is what I will concentrate on.


| < 1 > | 2 | 3 | Next page >> | Printer-friendly page |

Comment List


Topic: Author:
Time:
Internet Explorer 4 and newer Paul Kenneth Egell-Johnsen 23.11.2000 09:51

Will always show its own 404 page. Therefore make sure that the total page size of your 404 document (including graphics) is larger than 512 bytes.




Forgot your password?

Register a new user

Results

Polls