8/18/2006
Mod_Auth_MySQL and ErrorDocument with Apache
Mod_Auth_MySQL is a useful Apache module for allowing HTTPD Authentication against a MySQL database. This makes it very convenient to code a simple authentication process in PHP.
I beat my head against this problem for an hour before I found the solution…
When using an ErrorDocument directive in a .htaccess file similar to the form:
Apache, ErrorDocument 401 and Mod_Auth_MySQL don’t seem to play nice together. Tested on several different servers, Apache kept throwing a 401 Unauthorized error back no matter how I configured it.
Turning off the ErrorDocument 401 directive for the protected directory with the following directive seems to work around the problem.
Not a perfect solution as 401’s in the protected directory will either be blank or the Apache default.
Popularity: 13%


