For CakePHP errors, I know that there are CakeError and AppError solutions. But I need to do a redirect in the controller.
In AppController there is:
function afterFilter() { if ($this->response->statusCode() == '404') { $this->redirect(array( 'controller' => 'mycontroller', 'action' => 'error', 404),404 ); } }
But this does not create a 404 status code. It creates a 302 code. I changed the code to this:
$this->redirect('/mycontroller/error/404', 404);
But the result is the same.
I added this; it did not work and is deprecated:
$this->header('http/1.0 404 not found');
How can I send 404 code to the controller redirection?
source share