Why is this not working, as in the pre-set 404 page is not loaded:
header(\"HTTP/1.0 404 Not Found\");
exit;
.htaccess has the
I noticed that it does not work so I created a class with a static method to solve the problem
I have a directory /error-pages where I store all error file
I have a class file error.php which can be included at the top of every page
class ServerError{
public static function show($page){
require $_SERVER['DOCUMENT_ROOT'].'/error-pages/'.$page.'.php';
exit();
}
}
So on your home.php page for example you say
if (my404IsTrue) {
ServerError::show("404");
}
this way. you can use it for any other kind of error be it 403 or a custom error
Hope it Helps