APACHE: ErrorDocument help

APACHE: ErrorDocument help

Post by Derek Bruf » Sat, 17 Jul 1999 04:00:00



Two questions about the ErrorDocument directive:

1)  I've got a line "ErrorDocument 404 /file_not_found.cfm" in httpd.conf
that apparently directs all 404 errors to the same page in my document root
directory.  The problem is that all of the relative links on this error
response page are broken if the 404 error comes from anywhere other than the
document root directory.  Can this be fixed?

2) Can I put a .htaccess file in any subdirectory (of the document root
directory) with an ErrorDocument directive in order for that subdirectory to
have its own 404 error response page?  I've tried this, but all I get is the
default 404 error message (not even the file_not_found.cfm specified in
httpd.conf).  I've got "AllowOverride FileInfo" in my config files, so
that's not the problem.

Help?

Derek Bruff
ENVOY Corporation

 
 
 

APACHE: ErrorDocument help

Post by Joshua Sliv » Sun, 18 Jul 1999 04:00:00



> Two questions about the ErrorDocument directive:
> 1)  I've got a line "ErrorDocument 404 /file_not_found.cfm" in httpd.conf
> that apparently directs all 404 errors to the same page in my document root
> directory.  The problem is that all of the relative links on this error
> response page are broken if the 404 error comes from anywhere other than the
> document root directory.  Can this be fixed?

No.  Use absolute URLs in error documents.  This happens because the
browser (which is responsible for resolving relative URLs) never knows
that it is accessing /file_not_found.cfm.  It thinks it is getting the
original document.  Of course, you could always use a full URL in the
ErrorDocument, thereby getting an external redirect to the error page,
but the proper solution is just to use absolute references.

Quote:> 2) Can I put a .htaccess file in any subdirectory (of the document root
> directory) with an ErrorDocument directive in order for that subdirectory to
> have its own 404 error response page?  I've tried this, but all I get is the
> default 404 error message (not even the file_not_found.cfm specified in
> httpd.conf).  I've got "AllowOverride FileInfo" in my config files, so
> that's not the problem.

This should work.  Another way you could try is putting the
ErrorDocuments inside <Directory> sections in your main config instead
of using .htaccess files.  This will also improve performance.

--
Joshua Slive

http://finance.commerce.ubc.ca/~slive/

 
 
 

1. Help with ErrorDocument Directive in Apache.

I have apache set up on Red Hat and am using basic authentication for a
directory access in one of my virtual hosts. I want to use a custom 401
error page when authorization fails. My question is: Where in the conf
file do I establish that if I just want that custom 401 page for that
specific virtual host only, not all the virtual hosts? Any help is
appreciated. Thanks in advance.

Patrick

Sent via Deja.com http://www.deja.com/
Before you buy.

2. Newbie : a couple of simple questions.

3. Help w/ ErrorDocument in apache

4. Trying to free nonexistant swap-page

5. dcopserver; can't start kde

6. Apache 1.2.6: ErrorDocument rerouting...

7. Problem building kernel 2.4.20

8. Apache/CGI: How to toggle an ErrorDocument from a CGI ?

9. ErrorDocument POST - Apache/1.3b6

10. Apache ErrorDocument

11. Bug in Apache 1.3.12 with ErrorDocument 401?

12. Redirect Apache ErrorDocument 500 to display perl errors/warnings?