homepage Welcome to WebmasterWorld Guest from 54.198.42.105
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Apache and ErrorDocument.
Aresh




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

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




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

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




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

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved