Błędy CakePHP Wiem, że istnieją rozwiązania CakeError i AppError. Ale muszę wykonać przekierowanie w kontrolerze.Przekierowanie CakePHP z kodem statusu 404
W AppController istnieje:
function afterFilter() {
if ($this->response->statusCode() == '404')
{
$this->redirect(array(
'controller' => 'mycontroller',
'action' => 'error', 404),404
);
}
}
Ale to nie tworzy kod stanu 404. Tworzy kod 302. Zmieniłem kod do tego:
$this->redirect('/mycontroller/error/404', 404);
ale wynik jest taki sam.
dodałem to, że nie działa również przestarzałe:
$this->header('http/1.0 404 not found');
Jak mogę wysłać kod 404 z kontrolerem przekierować?