We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

302 status code after POST

Hi, my form has this action:

<form method="post" action="/index/save">

My indexController looks like this:

public function saveAction() {
     ...
    $this->response->redirect("/statistic");
    $this->view->disable(); 
    return;
    ....

It's all working but the status code of /index/save is "302 Not found". How can I change that?

Thanks!



950

Why did you write $this->view->disable(); after redirect? when you redirect request to other router you execute statisticAction() method.

Do you have this method?



79.0k
Accepted
answer

HTTP status code 302 means Found, i.e. your redirection is causing that. That is normal, even though I specify 303 status on such redirects. What exact issue do you have, or what do you want to achieve with that redirect?