Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Oct 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Redirecting 401 errors

    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.

  • #2
    New to the CF scene
    Join Date
    Oct 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    One more try...

    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:

    cgi-bin
    htdocs
    |_ 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)
    .htpasswd

    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?

  • #3
    New to the CF scene
    Join Date
    Oct 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thanks anyway, I got the answer on another forum...

    "ErrorDocument 401 /error/error_401.html" is the one that works.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •