.htaccess and custom error pages

They have: 115 posts

Joined: Feb 2000

I am trying to customize my 401 Error page and so far I haven't been able to get it to work. The 404 Error page works fine. I am using the following code in my .htaccess file.

ErrorDocument 404 http://www.domain.com/missing.html - this works fine
ErrorDocument 401 http://www.domain.com/authorization.html - this does not work

Can anyone give me any clues as to why this wouldn't work or how I might make it work?

Thanks!

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

http://httpd.apache.org/docs-2.0/mod/core.html#errordocument

According to that, you can use all sorts of different paths. I'd try the other options first and see if they work. If not, perhaps the server admin would be able to identify if custom error documents are enabled?

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

"Note that when you specify an ErrorDocument that points to a remote URL (ie. anything with a method such as "http" in front of it), Apache will send a redirect to the client to tell it where to find the document, even if the document ends up being on the same server. This has several implications, the most important being that the client will not receive the original error status code, but instead will receive a redirect status code. This in turn can confuse web robots and other clients which try to determine if a URL is valid using the status code. In addition, if you use a remote URL in an ErrorDocument 401, the client will not know to prompt the user for a password since it will not receive the 401 status code. Therefore, if you use an "ErrorDocument 401" directive then it must refer to a local document."

I should have kept reading, lol...

They have: 115 posts

Joined: Feb 2000

Got it to work.....thanks for the link Suz!

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.