htaccess and custom error docs

htaccess and custom error docs

Posted by: user919
Posted on: 2003-07-10 11:32:00

Hey there, I have a site where I'm using custom error pages using the following code in my htaccess file in the web root:

Options -indexes 
ErrorDocument 404 /oops/404.php
ErrorDocument 500 /oops/500.php
ErrorDocument 401 /oops/401.php
ErrorDocument 403 /oops/403.php

bad url:
http://disk919.com/buttcrack/

Actually, I have this on 3 sites, 1 works, the other 2 do not. one site has a slight variation (essentially same tho):

Options -indexes 
ErrorDocument 400 /error.php?code=400
ErrorDocument 401 /error.php?code=401
ErrorDocument 403 /error.php?code=403
ErrorDocument 404 /error.php?code=404
ErrorDocument 500 /error.php?code=500
ErrorDocument 501 /error.php?code=501
ErrorDocument 502 /error.php?code=502
ErrorDocument 503 /error.php?code=503

bad url:
http://andredion.com/buttcrack/

I have a site that's using the EXACT same .htaccess file as the first example and it's working fine. I even checked permissions on the directories and files involved and made them match the one that is working (shouldn't matter tho right?).

To top things off, the friend at anredion.com mailed support and got the following response:

In reply to:


Looks like its working just fine for me.. I dont see our default error
docs when i try to access pages that do not exist.. i just see

Error 403: Forbidden


should be getting a 404 error there from the description. Why would support be able to see custom error pages, although the wrong one, when noone else in Canad or the US can?

Little confused here =)

jason

Re: htaccess and custom error docs

Posted by: ardco
Posted on: 2003-07-10 14:40:00

Just a guess here. Maybe support requested something that actually exists, but has wrong permissions, or is otherwise forbidden? For example, when I tried

http://andredion.com/.htaccess I got

Error 403: Forbidden

OTOH, when I tried http://andredion.com/images/ I got

Error 404: Not found

I think permissions do matter to the extent that directories need read and execute, and files need read.

I think those errors I see (in USA) are different than the "standard" error pages, so maybe your custom error pages are a bit different on the two sites? On disk919.com I just see an h1 formatted number 403 or 404, for /images or somemiscfile.html, respectively.

Regards,

Bob S.

Re: htaccess and custom error docs

Posted by: user919
Posted on: 2003-07-10 14:57:00

well, I've tried it now in opera and netscape and I'm getting the proper error pages on both domains! WooHoo!

I'm still uttery confused however as in IE6 I've been able to see the custom pages fine on the one site, but not the other 2.

Off to check caching and Internet Options in IE...

jason

Re: htaccess and custom error docs

Posted by: will
Posted on: 2003-07-10 15:02:00

Make sure you have "show friendly error pages" (or something like that) UNchecked.

Re: htaccess and custom error docs

Posted by: user919
Posted on: 2003-07-10 15:04:00

well, replying to my own post seconds later...

I cleared my cahce / history / cookies to no avail, but..

IE / Tools / Internet Options / Advanced Tab
Uncheck show friendly HTTP error messages

I had no idea this would override custom error pages. In fact, still a bit of a mystery cuz I was seeing custom pages on some sites and not others.

jason

Re: htaccess and custom error docs

Posted by: user919
Posted on: 2003-07-10 16:00:00

snuck one in on me there man =)

jason

Re: htaccess and custom error docs

Posted by: BGilkison
Posted on: 2003-07-11 06:50:00

If I remember correctly, at one point, the IE "friendly" error pages were supposed to be generated only if the browser rec'd the appropriate HTTP message (403, 404, etc.) and if the length of the content sent by the response was less than a certain size (512 bytes, I think?).

...

OK, after a little Googling, I found the following article in the MS Knowledge Base: http://support.microsoft.com/default.aspx?scid=kb;EN-US;218155 -- My above assertion is basically confirmed, that in a nutshell, for Win-IE5+, there are Registry entries specifying thresholds for the content length of error messages, and if the rec'd error page is less than the threshold, then IE will display it's "friendly" error message.

Re: htaccess and custom error docs

Posted by: user919
Posted on: 2003-07-11 09:16:00

fantastic, this was really bugging me and I was prepared to do some serious research, thanks for beating me to it! =)

jason

Tags: php codehtaccess fileoopshttp403 errorthoindexesdocsurloptionserror 403403 forbiddenvariationconfusedweb root