I had the same question and although this is an old thread, I ended up simply using the 401 error document to display a particular page if authentication failed...
ErrorDocument 401 /not-logged-in.php
This seemed to do the trick for me in a simple way.