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

Redirect / Forward

Hello to all,

Im new to Phalconphp, im coming from kohana and laravel frameworks. Im working on a project with phalcon about one week and I'm enjoying it a lot !

One question , $this->response->redirect('controller/action'); or $this->dispatcher->forward() ??

thx

Hi @kadinho

redirect will do an http redirection (with the header location). It means that the browser of the client will change the page. It processes to a new routing (it can also be used to go to another website) and the actual script will end.

forward is internal, the browser of the client wont see any difference, you just execute a different controller.

I hope that's clear enough.



11.5k

Hi

the doubt was in forward but now is clear ! Thank you :)

regards

Just done a schema to be more clear : https://imgur.com/bvJhdEQ



11.5k

cant open ...