Sometimes an action or link needs to take the user back to where they came from each time rather than to an explicit location. When this happens CakePHP has a handy short cut that can be used from the controller or view
Controller:
<?php
public function action() {
$this->redirect(Controller::referer());
}
View:
<?php
echo $this->Html->link('Back', Controller::referer());