Note: This entry is applicable to server types that use our provided Apache web server. If you are using a custom server type, consult its documentation to determine how to display error messages.
NearlyFreeSpeech.NET provides a basic error page in response to the most common types of site errors. Sometimes, you may wish to override these pages and provide your own error messages that fit your site style or provide additional information. To do this, add the following line to the .htaccess file in your public directory (you'll need to create this plain-text file first if you don't have one):
ErrorDocument 404 /err404.html
Where 404 is the number of the error you wish to catch and err404.html is the name of the file you want displayed when an error occurs. You may use a PHP or CGI script for an ErrorDocument, but be careful not to use absolute paths to specify the name of your ErrorDocument.
Here are the most common errors you can catch in this fashion:
- 401 Authorization Required
- Indicates that a username and password are required but were not provided or were incorrect too many times.
- 403 Forbidden
- Indicates that security restrictions prevent the requested page from being returned. This is the error returned for new sites because our default security settings prohibit automatic directory indexing.
- 404 Not Found
- Indicates that the requested page or object was not found, either due to a typo or a broken link.
- 500 Internal Server Error
- Usually indicates that a CGI or PHP script encountered an error.
Due to the design of our network, you typically cannot use an ErrorDocument to catch a "503 Service Unavailable" error. Such errors do not routinely occur except during system maintenance or some types of partial service interruptions. They may also occur if you have a custom server type with improperly configured proxies or daemon processes that are not working.