View Full Version : Redirecting 401 errors

10-12-2004, 12:26 AM
I am new to .htaccess, and I have been following the advice in the .htaccess guides here. Unfortunately I have been unable to get this particular error page redirect to work.

I have a directory that is password protected via a local .htaccess file. I want to have my own 401 error page appear when a password is incorrect. I have tried putting "ErrorDocument 401 <myURL>/error_401.html" in my top-level .htaccess file but it does not work, instead I still get the default Authorization Required page. This happens whether I use a virtual or a full URL to my error page. My other error redirect commands (404 etc) work correctly.

I could be wrong, but it appears that the 401 redirect is failing because I am calling the error page from within the protected directory and the error page itself is being treated as protected despite it being physically elsewhere. No password, no error page.

I am obviously missing something simple here, so can someone please tell me how to get this to work?

Thank you.

10-16-2004, 04:14 PM
Okay, I will have one more try at this in the hope that someone can see where I am going wrong. It isn't a show-stopper, but it is untidy and therefore annoying!

I want to redirect password failure errors (401) to my own error page, but my own page never appears, I just get the standard Authentication Required page. My other error pages work (404 etc) but not 401.

This is my basic set-up:

|_ error
| |______ error_401.html
| |______ error_404.html (etc)
|_ members
| |______ (private pages .html)
| |______ .htaccess (password authentication)
|_ .htaccess (error page redirect commands for 401, 404 etc. using full URL)
|_ (other pages .html)

My error redirect lines are in the form

ErrorDocument 401 http://www.mywebsite.com/error/error_401.html

Incidentally I have tried using /www/m/mywebsite/htdocs/error/... addresses but then it doesn't find any of my error pages.

So, I call up a page in the members directory and am asked for my password. I fail to enter it and should get my own error_401.html page. Instead, I get the standard Authentication Required page. This seems to work for other people, so what am I doing wrong?

Any ideas anyone?

10-16-2004, 09:29 PM
"ErrorDocument 401 /error/error_401.html" is the one that works.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum