Welcome to WebmasterWorld Guest from 126.96.36.199
I have many directories, and for some of them, i would like to specify a personalized 404 error. So i would make a different .htaccess and 404.html for each directory. How could i make it?
<limit GET POST>
ErrorDocument 401 [domain.com...]
ErrorDocument 403 [domain.com...]
ErrorDocument 404 [domain.com...]
Where is the problem?
PS : I'm on a shared server, i coudn't touch to the httpd.conf...
Welcome to WebmasterWorld [webmasterworld.com]!
I am not sure what problem you are having, if any. However, the syntax of your ErroDocument statements is incorrect, and will result in 302-Moved Temporarily status being returned by your server, rather than the desired server status code (401, 403, 404, etc.).
If you read the Apache ErrorDocument Documentation [httpd.apache.org], there is a paragraph warning about this problem. You can also confirm the problem using the WebmasterWorld Server Headers checker [webmasterworld.com].
In order to return the correct server status code, you must use a local path in your ErrorDocument directives:
ErrorDocument 401 /error/dir1/401.html
ErrorDocument 403 /error/dir1/403.html
ErrorDocument 404 /error/dir1/404.html
You may create different .htaccess files to handle errors for each of your (sub)directories, or you may centralize all error handling in your "main" .htaccess file in your web root directory - whichever you like. The server will check each .htaccess file along the path to the requested resource, and process whichever applicable ErrorDocument directive it finds first.