404 Redirects Made Easy
For more information on .htaccess, check out our .htaccess Primer.When someone visits your site and requests a document that is not found there, they will receive what is known as a “404” or “Document Not Found” Error. If you do nothing to modify how your server responds to this error, you’re throwing away traffic and money.
The Problem
404 errors are generally generated in one of three ways: either because you moved or renamed a page without updating the referring hyperlink, because the surfer mistyped the URL while trying to enter it by hand, or because someone is trying to “guess” their way around your website. Let’s take a closer look at why some of these problems occur.
The first one is simple. You build a page and then submit it to search engines and link lists, etc. Later, you move it to a different directory, or change the name of it. I have done this before, when switching sites over to use Server Side Includes. My server required those pages to end in a “.shtml” extension. Unless I re-submitted my link everywhere, traffic that was going to “index.html” would receive a “404” and be “lost.” While you could easily use a redirection page to handle this traffic (which is what I did), there are other alternatives, as we will see later.
In the second example, a surfer mistypes the URL while entering it by hand (this will also cover erroneous submissions to search engines, et al, ‘recommendations’ to friends via email, true ‘type-in’ traffic, and all other such instances of transcription error). This is in simple terms a “fuck up” – but it’s still traffic worth preserving.
The final example is that of someone “guessing” their way around your site. They are trying to access your “members” area without purchasing a membership, or download your content by following a logical naming structure, i.e.: following your gallery page link to “pic01.jpg” and then without returning to the gallery page, manually entering “pic02.jpg” etc. If there is no “pic02.jpg” they will generate a 404 error.
“This is in simple terms a ‘fuck up’ – but it’s still traffic worth preserving.”
The Solution
While you cannot prevent most of these problems from happening, you can mitigate the results through the simplest incarnation of the mysterious “.htaccess” file. If you are unfamiliar with this file, it is a text file (named “.htaccess” and NOT “.htaccess.txt”) that contains commands for the Apache web server, telling it how to handle a variety of issues, including missing pages. In its simplest form (when used solely for 404 redirection) an .htaccess file need only contain one line:
ErrorDocument 404 http://AdultSiteListing.com/
“ErrorDocument” is the situation to be handled, “404” as we’ve discussed is the error code for missing pages. “http://AdultSiteListing.com/” is the URL that you wish the surfer to be directed to. This could be your home page, a help page, or even your sponsor. Some sponsors (like MaxCash with their “404 traps”) even offer special tools to help you profit from this traffic.
Upload this document to your root directory, and test it out. Type your URL in and add a bogus page name, such as bogus.htm. If you are transferred to the URL that you specified in the file, then everything worked. If not, check that your file is named correctly and was uploaded as an ASCII file. Still no luck? Well, this only works on a UNIX box – and you might be running NT!
For more information on .htaccess, check out our .htaccess Primer.