Can header( "Location: $location"); be used after Apache's 404 redirection?

I'm trying to build reply form is generalized for user feedback, user troubleshooting and 404 (page not found) errors.

One thing I want to do is detect cookies and browser preferably using PHP (although I know it can be done with Javascript). I'm using PHPClientSniffer (www.asphyxia.com). The cookies test requires setting a cookie and redirecting to the same page to detect the cookie.

Here's a stripped down example:

In .htaccess, I set:
ErrorDocument 404 /redirect.php

redirect.php has:
<?php
header("Location: http://www.mydomain.com/index.php");
?>

Typing http://www.mydomain.com/index.php directly into the browser works.

Typing http://www.mydomain.com/redirect.php directly into the browser works to give me index.php (as desired).

Typing http://www.mydomain.com/not_here just gives me a blank page.

Why doesn't the 'not_here' page follow through to give me the desired index.php page?

Thanks.

Rob

    Write a Reply...