Custom error pages


Web Standards: RFCs Back to RDP Web Resources FAVICON - how's it used?

On Apache web servers, you may be able to set up a few nice little features for your site.

For example, have you ever noticed that on your site, when you mistype a URL, you get that ugly 404 error page but on the really kewl sites, you get a custom-designed page that soothes you with friendly suggestions and pointers to alternate links and like that?

It's almost scarily simple to do, ya know. Create a file called htaccess.txt and in it put this line:

ErrorDocument 404 URL_TO_ERROR_PAGE.HTM

For URL_TO_ERROR_PAGE.HTM, substitute the full URL to the web page you want visitors to see when they mistype a link (or click a link that you've mistyped tsk, tsk, tsk)

Upload this file to the root directory of your site as .htaccess
Create and upload the error page you want visitors to see as well.

Now type in a non-existent URL on your site. With luck, your custom error page should appear.

The .htaccess file in your site's root directory becomes the default for the rest of your site, but you can override it on a sub-directory by sub-directory basis by putting a different .htaccess file in a sub-directory.

One thing to watch out for: DON'T delete or rename the custom error file. Or if you do, change the .htaccess file to reflect the change. If the 404 error file goes away here's what happens - looks like a basic programmer's nightmare:

  1. Somebody mistypes a link on your site
  2. The web server tries to serve up the custom error file
  3. The link to the the custom error file is broken so go to 2

Until the user closes their browser or hits the stop button, we're in an infinite loop here, folks, running up web traffic and wasting everybody's time.

And this can result in incredible amounts of web traffic. It looks so much like a virus attack that you may even get concerned calls from your web hosting company. I know I did when I inadvertently pulled this stunt. Ooops.


Web Standards: RFCs Back to RDP Web Resources FAVICON - how's it used?

Content & site maintenance by

Friday The Automatic FAQ Maker