Here's the relevant part of the .htaccess file:
ErrorDocument 400 /var/www/errors/index.html
ErrorDocument 401 /var/www/errors/index.html
ErrorDocument 403 /var/www/errors/index.html
ErrorDocument 404 /var/www/errors/index.html
ErrorDocument 500 /var/www/errors/index.html
Docuement root is set to /var/www/mywebsite/web, it's on of many vhosts. I can navigate to the index.html page.
All I'm seeing is the generic Apache 401 page, any thoughts.
EDIT: This is the error message in my browser:
This server could not verify that you
are authorized to access the document
requested. Either you supplied the
wrong credentials (e.g., bad
password), or your browser doesn't
understand how to supply the
Additionally, a 401 Authorization
Required error was encountered while
trying to use an ErrorDocument to
handle the request. Apache/2.2.9
(Debian) PHP/5.2.6-1+lenny8 with
Suhosin-Patch Server at www.dirbe.com
Make sure that /var/www/errors is readable by the apache user and include this in your apache configuration:
<Directory /var/www/errors> Order allow,deny Allow from all </Directory>
This question (and answers and comments) helped me a bunch, thanks much!
I solved a slightly different way, and wanted to share. In this case, we needed to provide a custom 401 error document and the root path needed to be proxied to a backend app.
So, for example, http://example.com needed to serve content from http://internal-server:8080/. Also, http://example.com needed to be protected using Basic Auth with a custom 401 error document.
So, I created a directory named "error" in the DocumentRoot. Here's the relevant lines from the vhost:
ErrorDocument 401 /error/error401.html # Grant access to html files under /error <Location "/error"> Options -Indexes Order Deny,Allow Allow from all </Location> # restrict proxy using basic auth <Proxy *> Require valid-user AuthType basic AuthName "Basic Auth" AuthUserFile /etc/apache2/.htpasswd </Proxy> # Proxy everything except for /error ProxyRequests Off ProxyPass /error ! ProxyPass / http://internal:8080/ ProxyPassReverse / http://internal:8080/