Redirection to a specific URL.

@param string $url              URL of redirection
@param int    $httpResponseCode HTTP Redirection code (301, 302...)

@return void
767184
protected function redirect(string $url, int $httpResponseCode = 302): void
    {
        header('Location: ' . $url, true, $httpResponseCode);
        exit;
    }
930713
public void redirect(String location, int httpStatusCode) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("Redirecting ({} to {}", httpStatusCode, location);
        }
        response.setStatus(httpStatusCode);
        response.setHeader("Location", location);
        response.setHeader("Connection", "close");
        try {
            response.sendError(httpStatusCode);
        } catch (IOException e) {
            LOG.warn("Exception when trying to redirect permanently", e);
        }
    }
1302064
private function respondOnOptionsRequest(int $httpResponseCode): void
    {
        http_response_code($httpResponseCode);
        header('Content-Type: application/json');
        header('Access-Control-Allow-Origin: *');
        header('Access-Control-Allow-Headers: *');
        exit;
    }
112181
public function redirect($url, $header=301)
    {
        $this->disableLayout();
        $this->setNoRender();

        $this->_params["dispatcher"]->clearHeaders();
        $this->_params["dispatcher"]->addHeader("Location", $url, $header);
    }
1258994
public static function location($response, $url, $code = 302) {
        $response->status($code);
        $response->header('Location', $url);
        $response->end();
    }
882192
public function redirect($path, $query = [], $http_response_code = 302) {
		$url = $this->create($path, $query, true, '&');
		header('Location: '.$url, true, $http_response_code);
		die('');
	}
1087071
protected function redirect($source, array $parameters = array(), $code = 307)
    {
        if ($source instanceof Url) {
            $url = $source->toString();
        } elseif (filter_var($source, FILTER_VALIDATE_URL)) {
            $url = $source;
        } else {
            $url = $this->reverseRouter->getUrl($source, $parameters);
        }

        if ($code == 301) {
            throw new StatusCode\MovedPermanentlyException($url);
        } elseif ($code == 302) {
            throw new StatusCode\FoundException($url);
        } elseif ($code == 307) {
            throw new StatusCode\TemporaryRedirectException($url);
        } else {
            throw new RuntimeException('Invalid redirect status code');
        }
    }
786348
public function redirect($url = null)
    {
        if (null === $url) {
            $url = $this->getServer('HTTP_ORIGIN');
        }
        ob_start();
        header('Location: ' . $url);
        ob_end_clean();
        Security::getInstance()->updateSession();
        exit(t('Redireccionando...'));
    }
1056655
protected function redirectTo($uri = '', $type = 'location', $httpResponseCode = 302) : AbstractBaseController
    {
        $container = $this->container();
        if ($container->has('url')) {
            $container->get('url')->redirectTo($uri, $type, $httpResponseCode);
        }

        return $this;
    }
1335781
public function index(HTTPRequest $request)
    {
        /** @var RedirectorPage $page */
        $page = $this->data();
        if (!$this->getResponse()->isFinished() && $link = $page->redirectionLink()) {
            $this->redirect($link, 301);
        }
        return parent::handleAction($request, 'handleIndex');
    }
465815
public function redirect($uri = '', $code = 302)
    {
        Base::getLog()->debug(__METHOD__ . ' redirect from controller', [
            'uri'  => $uri,
            'code' => $code,
        ]);
        Base::getHttp()->redirect((string) $uri, $code);
    }
172140
public static function createRedirect($url, $statusCode = Response::HTTP_FOUND, array $headers = [])
    {
        $view = static::create(null, $statusCode, $headers);
        $view->setLocation($url);

        return $view;
    }
1207929
public function setRedirectUri(UriInterface $uri, int $statusCode = 303): void
    {
        $this->redirectUri = $uri;
        $this->statusCode = $statusCode;
        // TODO: This can be removed after the full changes are done for next major.
        $this->headers->set('Location', (string)$uri, true);
        $this->setStatusCode($statusCode);
    }
1088425
public function redirect ($url, $statusCode = 302)
		{
			parent::redirect($url, $statusCode);
			Yii::$app->end();
		}
410787
public function redirect($url, $isPermanent = false)
    {
        $this->setBody('');
        $this->setResponseCode(302);
        if ($isPermanent) {
            $this->setResponseCode(301);
        }
        $this->setHeader('location', $url);
        $this->send();
    }
744927
protected static function createRedirectResponse($url, $code, $headers)
    {
        $r = new RedirectResponse($url, $code, $headers);
        $r->setRequest(Request::getInstance());

        return $r;
    }
1125841
def redirect(url, code=303):
    
    scriptname = request.environ.get('SCRIPT_NAME', '').rstrip('/') + '/'
    location = urljoin(request.url, urljoin(scriptname, url))
    raise HTTPResponse("", status=code, header=dict(Location=location))