Answer the question
In order to leave comments, you need to log in
How to make a custom 404 page return the correct code?
The site runs on nginx+php-fpm+cakephp - custom 404 page gives 200 OK, how to make it give the correct code? How can I check what the problem is, in the nginx settings, php-fpm or cakephp code?
Answer the question
In order to leave comments, you need to log in
To be honest, I have not studied CakePHP, but if you look at how 404 errors are excluded there
public function view($id) {
$post = $this->Post->findById($id);
if (!$post) {
throw new NotFoundException('Could not find that post');
}
$this->set('post', $post);
}
header("HTTP/1.0 404 Not Found")
or for Fast-CGIheader("Status:404 Not Found")
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question