I am using PHP for my project and I have .htaccess
file which has code below;
ErrorDoccument 404 /error-handler.php
This code is used to send or use error-handler.php
file for every 404
error. Everything till here is working. But I want a file named call-404.php
which when opened from browser should show 404 error and it must be handled by .htaccess
file above. I tried using;
http_response_code(404);
also,
header("HTTP/1.1 404 Not Found");
All the above code does says HTTP ERROR FILE NOT FOUND
but the 404 at this condition does not does as per .htaccess
file. It just displays browser defined 404 error page. What is the solution for it?
And This question is not simply 404 redirection using .htaccess
or simply use of http_response_code(404);
. This question shows and wants solution of inability of .htaccess
redirection on response to http_response_code(404)
.