View Single Post
Old 02-21-2010, 05:18 PM   PM User | #2
F00Baron
New to the CF scene

 
Join Date: Feb 2010
Location: Texas
Posts: 8
Thanks: 0
Thanked 3 Times in 3 Posts
F00Baron is an unknown quantity at this point
Re: the issue of not getting a 404:
Here's what I use:
PHP Code:
    header("HTTP/1.0 404 Not Found");
    exit(); 
exit() makes sure nothing else goes out after the 404 header.
Also you must ensure that nothing gets sent to the browser before the header() call. Look for echo() and print() before the header() calls.

As to sending the user to a good page after a few seconds, I don't think that's possible with a real 404. You could send them to a real page that says 'Page not found' and add a javascript timer to send them to a better page after few seconds.
PHP Code:
header('Location: my404.html');
exit(); 
The javascript would be something like:
Code:
<script type="text/javascript">
setTimeout("window.location='someBetterPage.html'",10000);
</script>
F00Baron is offline   Reply With Quote
Users who have thanked F00Baron for this post:
tomrshl (02-21-2010)