Creating custom error pages with Apache
Note: Custom Error Pages are available for Virtual Web Server (VWS) Customers only.
If you have recently reorganised your site, and there is the chance that people have bookmarked pages that no longer exist, or you have password restricted areas on your site, it is probable that viewers of your Web site may come accross an error message. Vicnet Virtual Web Server customers have the option of using custom error pages on their websites. Here's how to do it:
- Create 4 Web pages containing your own Web site's look and feel, along with appropriate error message explanations for the 4 most common errors viewers can encounter:
- HTTP error code 401 - Authorization Required
- HTTP error code 403 - Forbidden
- HTTP error code 404 - File Not Found
- HTTP error code 500 - Internal Server Error
- Using an FTP program such as FileZilla, upload these files to your Web space in ASCII or TEXT mode
- Open your favourite plain text editor such as Notepad (using Windows) or SimpleText (Apple Macintosh) and create a new file named htaccess.txt Alternatively if you have already password protected your Web site, open your existing htaccess file.
- Within your htaccess.txt file, type the following:
- Replace the pathTo/ portions with the address to your new custom error pages. e.g. if you have uploaded your HTTP error code 404 - File Not Found page to an errors folder, replace pathTo/ with /errors/, leaving you with:
- Using an FTP program such as FileZilla, upload these files to your Web space in ASCII or TEXT mode
- Rename the file from:
ErrorDocument 401 pathTo/authorization_required.htm
ErrorDocument 403 pathTo/access_forbidden.htm
ErrorDocument 404 pathTo/file_not_found.htm
ErrorDocument 500 pathTo/internal_server.htm
ErrorDocument 404 /errors/file_not_found.htm
htaccess.txt
to
.htaccess
i.e. Nothing should precede the "." and there should not be any filename extension such as .txt or .doc
You should now have custom error pages!