|
Extraordin-Air Team Final Project
|
|
|
Statement of Problem:
Configure the APACHE Web server to use custom error messages and make some creative error
pages.
Investigative Process:
I worked on Problem 26 first, and the same essential tools and concepts seem to be
applied here.
The .htaccess files (already enabled for #26) can also be used to call
up alternate html pages when the browser returns certain error codes.
Meryll has a nice table showing the various types of browser errors and the codes
they return on the "bells and whistles" section of her website www.alwanza.com/bells/statusCodes.html.
I have modified the /var/www/html/secure/.htaccess file I created for #26 so that it
includes the following line:
ErrorDocument 403 /custom403.html
where custom403.html includes the code for my custom error message for errors of type 403,
which happens to be "permission denied" errors. Right now, it's not working. It turns out
I should have been using error code 401! Now it works.
Some of my problems above stemmed primarily from a confusion about where the custom
error html files need to be located.
I put them within the secure directory because, went my thinking, it
is while trying to access the secure directory that permission denied errors
would be generated.
For some time I had files in both areas and wasn't clear which ones were being
activated.
I changed the text messages displayed in the error message so that they displayed
the directory they were stored in, and in this way figured out that all error
messages should be in
/var/www/html , and the .htaccess file pointing to the html pages should be
in this directory as well.
Recipe:
Configure /etc/httpd/conf/access.conf to so that the
AllowOverride variable is "All " instead
of "None ".
The web resources recommended "AuthConfig", but I couldn't get this to work.
The only problem I had was that I needed to set the AllowOverride variable
to "All " instead of
"AuthConfig " (see the notes for problem 26 also).
In the primary http directory (in our case /var/www/html ) where the
root page index.html document resides, create a file named
.htaccess
In this file you will place the error codes you want to provide custom messages for
and the name of the .html file you want to display when the http service returns
that particular error.
Here is a copy of the file on air.nesser.com for the team web page:
ErrorDocument 404 /custom404.html
ErrorDocument 401 /custom401.html
ErrorDocument 403 /custom403.html
ErrorDocument 500 /custom500.html
-
The first field tells the http service that you are providing an error document
as opposed to a user access control list or something else that might be found in
a
.htaccess file.
- The next field is the error code returned by the server
- and the last field is the .html file you want displayed.
In my case, these files are in the same
directory. I'm not positive they need to be,
but I did have problems when I had them elsewhere.
All this assumes that you've already created the .html files listed.
If you haven't you'll need
to!
|
|
|
|