Setting up Custom HTTP Error Pages
can set up custom error pages so that you can specify what someone
sees when they go to a page that does not exist. This can
help visitors to your site find their way around.
For a taste of what a custom error page can be like, see this example of a custom error page, which Elizabeth Buie has set up for Ã†sthetic Images Photography.
You set it up within a special file named .htaccess (yes, the name really starts with a dot)
You can create the .htaccess file right in your shell or FTP it up to your site.
your directory already has an .htaccess file, use that one
and modify it.
Your FTP software may need some adjustments to see the .htaccess file.
You can create/edit this file 2 ways.
If you have shell access to your account, log in via SSH, then use a local editor, such as vi or pico to edit the file
If you access your files via FTP, use your favorite client to download the existing .htaccess file, and upload it back.
To create/edit the .htaccess file locally, use a simple text editor (notepad on PC of Text Edit on Mac), and make sure to save the file in text format.
Always upload the file back to the server via FTP in text (ASCII mode, not binary)
Once the file is uploaded, make sure the permissions are set correctly on your .htaccess file. In UNIX speak, you need to chmod the .htaccess file to 644. (rw-r--r--)
From the shell, type: chmod 644 .htaccess
You can also use your FTP client to change the file permissions if you don't have shell access.
Customizing Server Error Messages
HTTP error codes
Web server error messages have standard associated numbers ("HTTP response codes"), for example the familiar #404 message meaning "File not found" or the classic #403: Forbidden
Your .htaccess file
1. Within your document root directory, /usr/home/your-username/docs, there might already be a (normally hidden) file called ".htaccess" - if you do not already have an .htaccess file then you may create one.
2. To create customized error messages, first make web pages that are suitable for this purpose.
Then simply add the following lines to the .htaccess in your document
directory, replacing the URL "/errors/400.html" with the URL of
your own custom error messages:
ErrorDocument 403 /errors/403.html
ErrorDocument 404 /errors/404.html
ErrorDocument 500 /errors/500.html
a. For example, something like the following: ErrorDocument 400 /~your-username/400.html
b. Or you could use a full URL (NOTE! This is best!): ErrorDocument 400 http://www.somewhere.com/errormsg.html
c. And you can also just write in the text or HTML to display. ErrorDocument 400 This is a 400 error.The ErrorDocument directive is briefly documented at the Apache Project site: http://www.apache.org/docs/custom-error.html