- - Code, Content, and Presentation
- -- PHP Server Side Scripting
- ---- header redirect question using 404 status code
rlange - 4:15 pm on Jul 19, 2012 (gmt 0)
It doesn't work because 404 is not a valid response code for redirects. The browser sees the 404 response code and just stops there.
You want to do something like this:
header( 'HTTP/1.1 404 Not Found' );
include( $_SERVER['DOCUMENT_ROOT'] . '/404.php' );
Adjust the path to
404.php as necessary.
[edited by: rlange at 4:29 pm (utc) on Jul 19, 2012]
Thread source: http://www.webmasterworld.com/php/4477152.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com