If you are like most people, the error pages on your site are the default pages provided by your host. In the past, I’ve encouraged affiliates to customize these pages, but many affiliates have come back to ask how to get the error traffic to the customer error pages.
Error messages occur due to a number of different conditions taking place on your site. These error conditions generate numbers to refer to the corresponding error condition.
Some of the more common error messages are as follows:
Error in Client
- 400 Bad syntax
- 403 Forbidden
- 404 Not Found (this one is the most common)
Error in Server
- 500 Internal Error
There are a few different ways you can create your error pages.
Create Error Files
Just create error pages and name them as follows:
error400.html
error403.html
error404.html
error500.html
Place these files in the home directory of your domain.
Create a .htaccess File
First, create the HTML page you wish to use as your error page and upload that file to your home directory.
Then create a .htaccess file and add lines that specify which pages should come up in place of the generic error pages. Below are examples error documents to specify that will be called for a given error condition:
ErrorDocument 400 http://www.your_domain.com/400.html
ErrorDocument 403 http://www.your_domain.com/403.html
ErrorDocument 404 http://www.your_domain.com/404.html
ErrorDocument 500 http://www.your_domain.com/500.html
Just add these lines to your .htaccess file and upload the .htaccess file to your home directory.
Add a Snippet of Code to Your .htaccess File
Plug the following bit of code into your .htaccess file, and then create a custom error file named “error.html” that contains your error message content.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /error.html
Whichever way you create your custom error pages, be sure to test after you’ve finished setting them up. If you are having problems, contact your host.