Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

beforeNotFoundAction redirecting

Can anyone tell me how can you do a redirect from this event? I cannot do that.


This way:

public function beforeNotFoundAction()
    return false;


Ah, my bad, I haven't realized that I did the wrong question. What I want is to redirect, but before that, use setStatusCode(). The problem is that, even with setNotModified(), the statusCode is deleted.


Phalcon\Http\Response::redirect automatically sets up a 301/302 status code which is the right way to perform a redirection:

You can pass the status code in the third parameter:

$response->redirect("", true, 304);


Ah well, nevermind. I forgotted that I was redirecting, so setting a 404 doesn't makes sense. Thanks.