Create a new redirect response to the previous location.

@param  int    $status
@param  array  $headers
@return \Fly\Http\RedirectResponse
975447
public function back($status = 302, $headers = array())
	{
		$back = $this->generator->getRequest()->headers->get('referer');

		return $this->createRedirect($back, $status, $headers);
	}
970643
public function back($status = 302, $headers = [], $fallback = false)
    {
        return $this->createRedirect($this->generator->previous($fallback), $status, $headers);
    }
92392
public static function setResponseStatus(int $status) : void
    {
        if (array_key_exists($status, Http::$http_status_messages)) {
            header('HTTP/1.1 ' . $status . ' ' . Http::$http_status_messages[$status]);
        }
    }
89784
protected function redirect($location, $status = 302, $headers = array()) {
		// Check if a output action has be already performed
		$this->_checkIfPerformed();

		// Create a redirect
		$redirectResponse = \Symfony\Component\HttpFoundation\RedirectResponse::create($location, $status, $headers);

		// Add request informationen
		$redirectResponse->prepare($this->application->requestStack->getCurrentRequest());

		// Replace response object
		$this->application->response = $redirectResponse;

		// Don't use a template
		$this->useTemplate(false, $status);
	}
581281
protected function createRedirect($path, $status, $headers)
	{

		if (isset($this->session))
		{
			// save to keep data because it will be flushed by the redirect
			$this->session->save('redirection');
		}

		wp_redirect($path, $status);
		exit;
	}
340609
public function refresh($status = 302, $headers = [])
    {
        return $this->to($this->generator->getRequest()->path(), $status, $headers);
    }
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 ();
    }
1134659
protected function html(string $html, int $status = 200, array $headers = []): ResponseInterface
    {
        return $this->responseFactory->createHtmlResponse($html, $status, $headers);
    }
976673
protected function redirect($uri, $status = 302, array $headers = []): ResponseInterface
    {
        return $this->responseFactory->createRedirectResponse($uri, $status, $headers);
    }
366293
protected function routeRedirectView($route, array $parameters = [], $statusCode = Response::HTTP_CREATED, array $headers = [])
    {
        return View::createRouteRedirect($route, $parameters, $statusCode, $headers);
    }
1306004
private function restoreResponse($headers, $body = null)
    {
        $status = $headers['X-Status'][0];
        unset($headers['X-Status']);

        if (null !== $body) {
            $headers['X-Body-File'] = [$body];
        }

        return new Response($body, $status, $headers);
    }
790858
public function redirectToIntended($default = '/', $status = 302, $headers = [], $secure = null)
    {
        respondWith(response()->redirectToIntended($default, $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;
    }
192067
public function redirect($url, $status = 302)
    {
        $response = $this;
        $response = $response->withAddedHeader('Location', (string)$url)->withStatus($status);
        return $response;
    }
506734
public function redirect($url, $status = 302)
    {
        $this->setStatus($status);
        $this->headers->set('Location', $url);
    }
355159
public function redirect($redirectStatus = 302)
    {
        if (!in_array($redirectStatus, [false, 301, 302], true)) {
            throw new InvalidArgumentException('The redirect status code must be 301, 302 or false');
        }

        $this->redirectStatus = $redirectStatus;

        return $this;
    }
725841
public static function json($data, $status = 200, $headers = array())
    {
        $jsonHeader = array('Content-Type' => 'application/json');

        $content = json_encode($data);

        return new Response($content, $status, $jsonHeader);
    }