Forum Moderators: phranque

Message Too Old, No Replies

Apache Error Messages 1.0

Not sending correct status code

         

WebWalla

12:39 pm on Jan 8, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



On my shared host I have the possibility of installing the above named application, which allows me to specify a file or message when certain status codes are produced.

So, for a "404 - Not Found" error message, my server con redirect the browser to example.com/404.html

However, if I do a server header check for this 404.html document which I have created, it gives me a "HTTP/1.1 302 Found" status, which is clearly wrong.

I have tried to rectify this, by adding the following code to the first lines of the document ..


<?php
header("HTTP/1.0 404 Not Found");
?>

... but not even this works (still gives 302).

Any ideas? Thanks.

Receptional Andy

12:49 pm on Jan 8, 2008 (gmt 0)



It may be that you are entering a full url (e.g. www.example.com/404/) as opposed to a relative one (e.g. /404/). A full URL will always trigger a redirect in ErrorDocuments.

WebWalla

1:17 pm on Jan 8, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Indeed, URL was absolute, but I thought that was the idea?

I want to capture all the mistyped and incorrectly linked absolute URL's instead of leaving them to Google for example (with the new toolbar functionality).

Any idea how I can do this then?

Thanks.

Receptional Andy

2:16 pm on Jan 8, 2008 (gmt 0)



I think you've misunderstood (or maybe I have!). If you enter /404/ into your control panel/htaccess file all should be well for visitors. But Apache will always redirect if you configure an ErrorDocument with an absolute URL.

WebWalla

4:48 pm on Jan 8, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sorry - my misunderstanding not yours - completely!

Yes, using the relative path works exactly as intended.

thanks a lot!