I have the following code for performing redirection. If my $includeFile does not exist it will redirect to a 404 page. This is a snippet from my index.php
if ( !file_exists($includeFile) )
Header( "HTTP/1.1 404 Page Not Found" );
Header( "Location: http://legascy.com/404_error/");
But http://legascy.com/404_error/ is showing HTTP Status 200 OK instead of 404.
How to solve this?
You need to place the header function for 404 on the “404_error” page instead of the page that redirects. This because the browser is sent to 404_error which has the default 200 status code.
And on 404_error/index.php: