Forum Moderators: phranque

Message Too Old, No Replies

ErrorDocument 404 in httpd.conf not working

Setting Apache error documents does not work

         

ForumKid1

5:10 pm on Jan 16, 2008 (gmt 0)

10+ Year Member



I have a VH block in httpd.conf such as:

<VirtualHost *>
ServerName www.myexample.com
DirectoryIndex index.jsp
DocumentRoot "/myroot/myfolder"
ErrorDocument 404 /myroot1/myfolder1
Redirect permanent / http://www.example.com/index.jsp
</VirtualHost>

The errordocument never gets served. All I get is the standard Internet Explorer 404 page. Even if I set the 404 errordocument in the main body of httpd.conf, still it doesnt serve it. I ran a trace over my server headers for a non-existant page, it's definitely returning a 404, but it just will not pickup the code. Does anyone have any idea why that would happen? The path to the ErrorDocument is there. I can verify that.

[edited by: jdMorgan at 5:42 pm (utc) on Jan. 16, 2008]
[edit reason] example.com [/edit]

jdMorgan

5:41 pm on Jan 16, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> All I get is the standard Internet Explorer 404 page.

You might want to try testing with a different browser. IE requires that the error document exceed a certain size -- 512 or 1024 bytes, typically -- before it will display the error document. This is controlled by the "Show friendly HTTP error pages" setting in IE. But since you cannot change your visitors' browser settings, you'll need to make your document long enough for IE to display it.

Testing with a different browser that does not interfere with error document display will tell you whether the problem is server-side, or just IE interfering.

Jim

ForumKid1

5:49 pm on Jan 16, 2008 (gmt 0)

10+ Year Member



Firefox shows the same standard error. So it has to be server side.

jdMorgan

6:01 pm on Jan 16, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



OK, you said you were seeing IE's error pagem there...

Let's check this, too:

ErrorDocument 404 /myroot1/myfolder1

should be


ErrorDocument 404 /myfolder1/[i]custom-error-page.html[/i]

or similar.

That is, it is a apecific-server Web-root-relative path.

Jim

[edited by: jdMorgan at 6:02 pm (utc) on Jan. 16, 2008]

ForumKid1

9:41 pm on Jan 16, 2008 (gmt 0)

10+ Year Member



Thats what I do have. I just put that myfolder1 stuff in as an example..sorry.

jdMorgan

10:31 pm on Jan 16, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'd suggest commenting-out your Redirect directive, since it will result in an 'infinite' redirection loop. Depending on what you're trying to accomplish, a different method will be required.

Sorry, I don't see anything else wrong.

Jim