In PHP I use the following code to indicate page not found:
header("HTTP/1.0 404 Not Found");exit();
In .htaccess
file I have the following line to handle 404 custom document:
ErrorDocument 404 /404.html
Now when I send the PHP 404 header I expect it to show the custom 404.html
defined in .htaccess
but instead it shows a message "this link appears to be broken". So it doesn't show the custom 404 page and if I remove the line from .htaccess
it still won't display the regular 404 page of the server and shows also the broken link message.
So how to make it show the 404 page when I send the header in PHP?