Redirect to a URL

@param string   $url
@param null|int $status
@return static
192067
public function redirect($url, $status = 302)
    {
        $response = $this;
        $response = $response->withAddedHeader('Location', (string)$url)->withStatus($status);
        return $response;
    }
1211904
public function status($status = null)
    {
        $this->reloadQueryAdapter();
        $this->activeQuery->status($status);
        return $this;
    }
1304944
public function to($path, $status = 302, $headers = [], $secure = null)
    {
        $path = $this->app->make('url')->to($path, [], $secure);

        return $this->createRedirect($path, $status, $headers);
    }
775258
public function redirect($location, $status = 302)
    {
        if (!$location) {
            return;
        }
        $this->status($status);
        $headers = $this->headers();
        $headers['Location'] = $location;
        return $this;
    }
429739
public function redirectIntended($path, $status = 302, $headers = [], $secure = null)
    {
        return Redirect::intended($this->uri() . '/' . $path, $status, $headers, $secure);
    }
1186269
public function redirect($path, $status = 301)
    {
        if (!$this->asWidget) {
            /** @var ResponseInterface $response */
            $response = (new ResponseInjector)->build();
            if (!$response) {
                throw new Exception('Component `response` not configured');
            }

            $response = $response->withStatus($status);
            $response = $response->getHeaderLine('Location: '.$path);

            return $response;
        }

        return false;
    }
1118558
protected function redirect(string $uri, int $statusCode = 302) : Response
    {
        return (new Response())
            ->setStatusCode($statusCode)
            ->setHeader('Location', $uri);
    }
350990
public function redirect($uri, int $status = 301): ResponseInterface
    {
        if (!\is_string($uri) && !$uri instanceof UriInterface) {
            throw new \InvalidArgumentException('Uri MUST be a string or Psr\Http\Message\UriInterface instance; received "' .
                (\is_object($uri) ? \get_class($uri) : \gettype($uri)) . '"');
        }

        $this->header->set('Location', (string) $uri);

        return $this->empty($status);
    }
764428
public function completeRedirect($url = null, $status = 302) {
		if ($url === null) {
			$url = $this->Controller->getRequest()->params;
			unset($url['pass']);
			unset($url['isAjax']);
		}
		if (is_array($url)) {
			$url += $this->Controller->getRequest()->getParam('pass');
		}
		return $this->Controller->redirect($url, $status);
	}
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);
    }
1111227
public function redirect($url, $parameters = [], $status = 302)
    {
        if (substr($url, 0, 1) == '@') {
            $route = substr($url, 1);
            $url = $this->generateUrl($route, $parameters);
        }
        return new RedirectResponse($url, $status);
    }
948836
public function redirect($uri, int $statusCode = 302): self
    {
        $this->headers->location($uri);
        return $this->fixateCode($statusCode);
    }
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 !');
        }
    }
976673
protected function redirect($uri, $status = 302, array $headers = []): ResponseInterface
    {
        return $this->responseFactory->createRedirectResponse($uri, $status, $headers);
    }
85076
public function setRedirect ($url)
	{
		$this->setHeader ('Location', $url);
		$this->setStatus (302);
		$this->setData (array ('message' => 'Redirecting to ' . $url));

		return $this;
	}
1217886
public static function redirect($location, $args = "", $status = 302) {
        global $is_IIS;
        if (!$location) {
            return;
        }
        if (!empty ($args) && is_array($args)) {
            $_args = [];
            foreach ($args as $n => $v) {
                $_args [ $n ] = $n . '=' . urlencode($v);
            }
            $args = implode('&', $_args);
        }
        if (!empty ($args) && is_string($args)) {
            if (strpos($location, '?') !== false) {
                $location .= '&' . $args;
            } else {
                $location .= '?' . $args;
            }
        }

        if ($is_IIS) {
            @header("Refresh: 0;url=$location");
        } else {
            if (php_sapi_name() != 'cgi-fcgi') {
                status_header($status); // This causes problems on IIS and some
            }
            @header("Location: $location", true, $status);
        }
        exit ();
    }
179185
public function redirect($from, $to, $status = 302)
    {
        $handler = function ($request, ResponseInterface $response) use ($to, $status) {
            return $response->withHeader('Location', (string)$to)->withStatus($status);
        };

        return $this->get($from, $handler);
    }