Q:

Prevent user from directly accessing a redirection URL in CakePHP

There are URLs which I use only for redirecting a user after a successful operation. (e.g. a "Thank you" page after submitting feedback).
The problem is that these pages can be accessed directly.
Is there a way to prevent this?

A:

function thank_you() {
    if($this->referer() != 'some_url') {
        $this->redirect('/');
    }
}

in the method you don't want to be accessible directly, just check to see if the referrer valid (i.e. the "contact form" for the "thank you" page.
If the referrer isn't the "contact form", you can redirect to wherever. If it matches, output the thank you page.       

