If you want different errors in different directories, then put an .htaccess in the directory and link it to the error page as above:On February 24, 2004 09:10 am, Srinivas Koppisetti wrote:Hi All, We want to display custom error pages based on the user directory. This page will only disply when they dont have access to see that page. Obviously we are using htaccess directory access file. I was wondering how we can do it in apache? Also I want to develop an interface that validates a user to this htaccess encripted password. How do we approach these issues? Thanks in Adv for you help. Srinivas'Hi, Have a look at the apache site (httpd.apache.org). There is a directive you can add to each directory stanza (or global) that defines what error page to display. Check their docs, but I think it is something like: ErrorDocument 404 /path_to/file You may also want to use the config file directory stanzas to do your access control instead of leaving the htaccess file in the document area. If by "develop an interface" you mean the pop-up login box, sorry, I can't help.
ErrorDocument XXX /path_to/file
For XXX use the correct error number. 404 is a PAGE NOT FOUND. You wanted a 401 AUTHORIZATION REQUIRED.
Mostly only the 400s are used. You can check your logs to see if any particular errors show up more than others or several times.
Client Request Errors | ||
400 | Bad Request | |
401 | Authorization Required | |
402 | Payment Required (not used yet) | |
403 | Forbidden | |
404 | Not Found | |
405 | Method Not Allowed | |
406 | Not Acceptable (encoding) | |
407 | Proxy Authentication Required | |
408 | Request Timed Out | |
409 | Conflicting Request | |
410 | Gone | |
411 | Content Length Required | |
412 | Precondition Failed | |
413 | Request Entity Too Long | |
414 | Request URI Too Long | |
415 | Unsupported Media Type |