header('HTTP/1.0 404 Not Found'); not doing anything
No, it probably is actually working. It's just not readily visible. Instead of just using the header
call, try doing that, then including 404.php
, and then calling die
.
You can test the fact that the HTTP/1.0 404 Not Found
works by creating a PHP file named, say, test.php
with this content:
<?php
header("HTTP/1.0 404 Not Found");
echo "PHP continues.\n";
die();
echo "Not after a die, however.\n";
Then viewing the result with curl -D /dev/stdout
reveals:
HTTP/1.0 404 Not Found
Date: Mon, 04 Apr 2011 03:39:06 GMT
Server: Apache
X-Powered-By: PHP/5.3.2
Content-Length: 14
Connection: close
Content-Type: text/html
PHP continues.
You could try specifying an HTTP response code using an optional parameter:
header('HTTP/1.0 404 Not Found', true, 404);
Use these codes for 404 not found.
if(strstr($_SERVER['REQUEST_URI'],'index.php')){
header('HTTP/1.0 404 Not Found');
readfile('404missing.html');
exit();
}
Here 404missing.html is your Not found design page. (it can be .html or .php)