Knowledgebase: Common Questions
Can I have custom error pages?
Posted by Head Nerd in Charge on 23 February 2004 05:21 PM
Of course you can have your own error pages! It's your site, it's your traffic and we don't want you to lose it. |
You can direct your error pages in your control panel account.
You will need to edit your .htaccess file in order to direct your error pages.
The following examples have been known to work on our systems. Documentation on mod_rewrite can be found at http://www.apache.org/docs/mod/mod_rewrite.html
FRONTPAGE WARNING: Any changes to your .htaccess file can corrupt your Frontpage extensions and render your site inaccessible. A backup copy of your .htaccess file should be made before you make any changes.
The .htaccess file is an ASCII text document that can be placed in any directory on your site. It can be used to control access to files and directories, and customize some server operation in your site. A .htaccess file can be created in any text editor like Wordpad or Simpletext. You must transfer your .htaccess file with FTP software using ASCII mode, not binary mode.
Setting Custom Error Messages
You can set custom error messages on a per directory basis. To do this create a text file called .htaccess in the directory you are trying to do this in. If you put the .htaccess file in your root directory it will affect all directories beneath it.
To make a certain error message number to go to a certain file put this in the .htaccess file:
ErrorDocument 404 http://www.yourdomainname.com/filename.html
404 is the error message you are trying to trap.
www.yourdomain.com/filename.html is the URL you are trying to send people who get that error message to.
You can also redirect web pages based on the requested directory or filename. To do this put this in your .htaccess file:
redirect /directory http://www.yourdomainname.com/redirect.html Where /directory is the URL you are trying to redirect and
http://www.yourdomainname.com/redirect.html is the URL you are trying to send them to.
You can put as many of these two types of statements as you want in your .htaccess file.