ManaPHP\Http\Response::redirect PHP Method

redirect() public method

Redirect by HTTP to another action or URL Using a string redirect (internal/external) $response->redirect("posts/index"); $response->redirect("http://www.google.com"); $response->redirect("http://www.example.com/new-location", false);
public redirect ( string | array $location, boolean $temporarily = true ) : static
$location string | array
$temporarily boolean
return static
    public function redirect($location, $temporarily = true)
    {
        if ($temporarily) {
            $message = 'Temporarily Moved';
            $statusCode = '302';
        } else {
            $message = 'Permanently Moved';
            $statusCode = '301';
        }
        $this->setStatusCode($statusCode, $message);
        $this->setHeader('Location', isset($this->url) ? $this->url->get($location) : $location);
        return $this;
    }