I've got a problem redirecting to another page using header() from a 404 script once a real 404 error has happened.
What I want to happen:
1) a page isn't found, goes to my 404 page
2) my 404 page works out where it should be going, & issues a header() to redirect to a new page
3) the new page appears...
What happens:
1) a page isn't found, goes to my 404 page
2) my 404 page works out where it should be going, & issues a header()
to redirect to a new page
3) nothing - doesn't redirect
It's definitely getting to my 404 page, I can output a custom error message, or whatever I want.
If I try the URL of the error script directly it all works fine, and the redirect takes place.
The problem only occurs when it's a real 404 error.
Currently I'm outputing html to do frame based forwarding in the 404 script, this does work from within a real 404 error, but it's not a
nice way of doing it.
Does anyone know if it is possible to issue a header() redirection command that still works from a real 404 error, and if so how do I do it ?
( eg with this code in the 404 page it only forwards when accessed directly, not when a 404 error occurs.
<?PHP
header("Location: http://www.phpbuilder.com");
exit();
?>
)