I have a custom 404 error page on my apache (404.php) and it works normally, but if someone or any search engine requests the /404.php page, the server returns 200 (OK), because the page actually exists.
I have already put the Disallow: /404.php on my robots.txt file to prevent Google from indexing that page, but I’d like to return 404, including to this page request.
Is there a way to also return 404 when someone reaches the 404.php directly?
I just whipped this up really quickly:
I checked it in Chrome, and this will return a 404 code in the header, and let you write whatever you’d like to the rest of the page. Just put the
headerfunction at the beginning of the page.