Redirects to the passed URL by adding a 'Location' header and
setting the appropriate status code, by default 301.

@param string  $url  The URL to forward to
@param integer $code The status code to set

@return void
543713
public function redirect($url, $code = 301)
    {
        $this->setStatusCode($code);
        $this->addHeader(HttpProtocol::HEADER_LOCATION, $url);
    }
349178
public function redirect(string $url, array $data = []) : void
    {
        $this->redirectUrl = $url;
        $this->redirectData = $data;
    }
920612
public static function RedirectPermanently(string $uri = '/', bool $immediately = false) :void
        {
            self::SetStatus(HttpStatusCode::STATUS_301);
            self::AddHeader('Location', urlencode($uri));

            if ($immediately) {
                self::ApplyHeaders();
                exit();
            }
        }
823971
static public function sendHeader( $code, $protocol = "HTTP/1.0" ){
		$text = self::getText( $code );
		header( $protocol.' '.$code.' '.$text );
	}
292665
public function redirect($url)
    {
        $location = $this->_request->getBasePath();
        $location = str_replace('//', '/', "{$location}/{$url}");
        $this->_response->setStatusCode(302);
        $header = new GenericHeader('Location', $location);
        $this->_response->getHeaders()->addHeader($header);
        return $this->disableRendering();
    }
322433
public function setCode( $code )
	{
		$this->_checkCode( $code );

		$this->_values['code'] = (string) $code;
		$this->setModified();
	}
1039560
public function redirect(string $location, int $code = Status::FOUND): self
    {
        $this->setStatus($code)->setHeader('Location', trim($location));

        return $this;
    }
1072090
public function redirect($route, $code = null)
    {
        /** @var Uri $uri */
        $uri = $this['uri'];

        //Check for code in route
        $regex = '/.*(\[(30[1-7])\])$/';
        preg_match($regex, $route, $matches);
        if ($matches) {
            $route = str_replace($matches[1], '', $matches[0]);
            $code = $matches[2];
        }

        if ($code === null) {
            $code = $this['config']->get('system.pages.redirect_default_code', 302);
        }

        if (isset($this['session'])) {
            $this['session']->close();
        }

        if ($uri->isExternal($route)) {
            $url = $route;
        } else {
            $url = rtrim($uri->rootUrl(), '/') . '/';

            if ($this['config']->get('system.pages.redirect_trailing_slash', true)) {
                $url .= trim($route, '/'); // Remove trailing slash
            } else {
                $url .= ltrim($route, '/'); // Support trailing slash default routes
            }
        }

        header("Location: {$url}", true, $code);
        exit();
    }
1324293
public function redirectVerified($code, $destination = null, $parameters = []): void
    {
        // first parameter is optional
        if (!is_numeric($code)) {
            $parameters = is_array($destination) ? $destination : array_slice(func_get_args(), 1);
            $destination = $code;
            $code = null;
        } elseif (!is_array($parameters)) {
            $parameters = array_slice(func_get_args(), 2);
        }

        /** @var Presenter $presenter */
        $presenter = $this->getPresenter();
        $link = $presenter->createRequest($this, $destination, $parameters, 'redirect');
        if ($presenter->getVerifier()->isLinkVerified($presenter->getLastCreatedRequest(), $this)) {
            $presenter->redirectUrl($link, $code);
        }
    }
409121
public function redirect($url, $status = 301)
    {
        $status = (int) $status;

        if (!empty($url)) {

            header($this->get('protocol') . ' 301 Redirect');
            header('Status: ' . $status . ' Redirect');
            header('Location: ' . $url);
            exit(0);
        } else {
            throw new \Exception('Url is empty !');
        }
    }
1029592
public function redirectTo( $url = 0, $code = 302 ) {
		if ( $url === null ) {
			$this->redirectTo = null;
			return true;
		}
		if ( !is_string( $url ) || !is_int( $code ) ) {
			return false;
		}
		$this->redirectTo = [ $url, $code ];
		return true;
	}
767184
protected function redirect(string $url, int $httpResponseCode = 302): void
    {
        header('Location: ' . $url, true, $httpResponseCode);
        exit;
    }
1328859
public static function redirect($url, array $parameters = [], int $statusCode = Response::STATUS_MOVED_PERMANENTLY) : Response
    {
        if (!empty($parameters)) {
            $url = $url . '?' . http_build_query($parameters);
        }

        $headers = new Headers();
        $headers->add(new Header('Location', $url));

        return new Response('', $statusCode, $headers);
    }
600615
public function redirect($url, $status = null)
    {
        $this->withHeader('Location', (string)$url);

        if (is_null($status) && $this->getStatusCode() === HttpMessage::HTTP_OK) {
            $status = 302;
        }
    }
948836
public function redirect($uri, int $statusCode = 302): self
    {
        $this->headers->location($uri);
        return $this->fixateCode($statusCode);
    }
1314358
public function redirect($url, $code = 302)
    {
        $this->code($code);
        $this->header('Location', $url);
        $this->lock();

        return $this;
    }
523955
public static function redirectTo(string $location, array $queryParameters = null): void
    {
        if (isset($queryParameters)) {
            header("Location: $location" . "?" . http_build_query($queryParameters));
        } else {
            header("Location: $location");
        }
        exit();
    }