Welcome to WebmasterWorld Guest from 54.226.147.190

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Apache and ErrorDocument.

     

Aresh

9:43 am on Jun 3, 2003 (gmt 0)

10+ Year Member



Hi,

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?

Actually :
.htacces (http://domain.com/dir1/):
Authname "X"
AuthUserFile /path/to/.htpasswd
AuthGroupFile /dev/null
AuthType Basic
<limit GET POST>
require valid-user
</limit>
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...

jdMorgan

4:26 pm on Jun 3, 2003 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Aresh,

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.

HTH,
Jim

Aresh

6:51 am on Jun 4, 2003 (gmt 0)

10+ Year Member



Thanks a lot :), it works.

I was sure to test with this syntax but i would have another problem last time. Now it works fine.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month