The simple answer to your question is no, you cannot make it more reliable without implementing custom authentication.
The only way to display Firefox and the Chrome page specified in the ErrorDocument 401 directive is to click the cancel button. In addition, there is no forwarding sent with HTTP code 401; rather, this is the content of the document specified in the ErrorDocument 401 directive. You can redirect using the HTML meta tag:
<Location "/protected"> AuthUserFile /path/to/users AuthName "This is protected area" AuthGroupFile /dev/null AuthType Basic Require valid-user #ErrorDocument 401 /register.html ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=/register.html\"></html>" </Location>
Possible solutions to your problem are creating a custom HTTP basic authentication module or using a language such as php that supports basic HTTP authentication.
http://php.net/manual/en/features.http-auth.php
Boris
source share