Custom error pages with Apache Normally, when a person surfs to a broken link in your site, or enters a URL incorrectly, they will see an error message such as "An Error Has Occurred! URL not found." With custom error pages, you create a more attractive error page that has the look and feel of the rest of your site. This is a rather difficult and advanced procedure which requires copying and editing files in UNIX. We recommend using custom error pages as a third or fourth generation modification to your site. How to create a custom error page You should start with the standard Apache error 404 file. It contains a couple of Server Side Includes that give the URL of the requested page, and the URL of the referring page that contained the bad link. 1) Log in to your UNIX account. You will need to enter the following commands at the UNIX command line in order to copy the Apache error file into your public_html directory.
If you are unable to find the e_404.html file, you may obtain a copy of the file from this site. 2) Use ftp (or Home Directory) to download the file to your local machine. Viewing the file in your Web browser and saving it will remove the SSIs, so only ftp or Home Directory will work. 3) After you have downloaded the file, use your Web editor (Dreamweaver, etc.) to edit this file to reflect the look and feel of your site. Keep the SSIs unchanged. An SSI is a specially formatted HTML comment. Once you have finished, you should upload the file back to your public_html directory. 4) Using a plain text editor, create a file in your web site's directory named: .htaccess Yes, that is a dot at the beginning of the file. UNIX configuration files often begin with a dot. This type of file is referred to as a "dot file" or in particular this case "dot h t access". (as another example .pinerc is called "dot pine r c") Apache configuration commands are called "directives". You can create customized sets of commands, although you must place them in a specially named file in your public_html directory. The Redirects discussed below also use Apache directives. You can have many directives in a single .htaccess file. 5) The contents of your .htaccess file depend on what type of site you have.
6) Save your file. Web
Development Support | General
Info | Getting Started
| Design & Promotion
If you need further assistance with Web applications or questions, send e-mail to web-consult@virginia.edu or call the ITC Help Desk at 924-3731. |
|||||||||||||||||||||||||||||||||||