When a Web server encounters a 404 error, it calls a particular file, as
specified in its configuration. By default, this file looks more or less
like the one at the top of this article. But that's about as unhelpful as a
404 page can be. Nice minimal design, but little else to recommend it. Much
better to design your own.
If You're Using Apache
You probably have a .htaccess file in your Web root directory already,
controlling various Apache functions. If you don't have such a file, you
need to create one. You can do this whether you are in charge of the
server or just one of a number of people who use it.
To serve a custom 404 page, the .htaccess file should contain a
line like this:
ErrorDocument 404 /errordocs/404.html
where "/errordocs/404.html" is the name of the file you want to serve. This
doesn't have to be a flat HTML file: It can be PHP, ASP, SHTML, or whatever
you like. Also note that the file can contain a series of ErrorDocument
lines, using the same syntax to serve custom pages for various other
errors: 401, 500, whatever you like, just by replacing "404" with the
relevant number.
If You're Using IIS
Open the Properties of the Web service. Click the Custom Errors tab, select
"404", and click "Edit Properties". Select "URL" for Message Type, and
input the location of your custom error page.
Setting up a custom error page on IIS requires access to the server's
MMC interface. If you don't have this access, Port 80 Software offers a
third-party
solution that you can buy.
Otherwise
If you're running some other Web server, I'm sure it's not too hard
to set up custom error pages. If you don't control your own Web server,
read the documentation provided by your Web host. Many ISPs have their own
proprietary interfaces for changing error documents.
NOTE: Microsoft, in their unerring wisdom, implemented a "feature" in
Internet Explorer 5 that displays its own built-in error page rather than
the 404 page the server sends. To circumvent this helpful feature,
your custom 404 page has to be bigger than 512 bytes. So drop in a JPEG of your shining mug or something.
next page»