Permanent redirect (301) to the given URL

@param string $where

@return Redirect
353375
public static function permanent(string $where): Redirect
    {
        $self = new static();
        $self->statusCode(301)
          ->setHeader('Location', $where)
          ->setHeader('Connection', 'close')
          ->setHeader('Content-Length', 0);

        return $self;
    }
425234
public function whereRaw(string $condition): self
    {
        $this->condition->where([new RawExp($condition)]);

        return $this;
    }
765578
def redirect_response(self, url, permanent=False):
        
        if permanent:
            self.send_response(301)
        else:
            self.send_response(302)
        self.send_header("Location", url)
        self.end_headers()
238597
public function redirect($location, $isPermanently = false)
    {
        if ($isPermanently) {
            header('Location: ' . $location, false, 301);
            exit;
        } else {
            header('Location: ' . $location, false, 302);
            exit;
        }
    }
450746
protected function seek($where = null)
    {
        if ($where === null) {
            return $this->count;
        }

        $this->count = $where;

        return true;
    }
475429
public function where($where)
    {
        //Argument 1 must be a string or array
        Argument::i()->test(1, 'string', 'array');
        
        if (is_string($where)) {
            $where = array($where);
        }
        
        $this->where = array_merge($this->where, $where);
        
        return $this;
    }
585993
public function exist($where = null): Statement
    {
        $this->operation = 'exist';
        $this->fields = '*';
        if ($where) {
            $this->where = $where;
        }
        return $this;
    }
542873
static function RedirectRelative($target, $noExit = false)
    {
        session_write_close();
        $dirName =  dirname($_SERVER["PHP_SELF"]);
        if ($dirName == "/")
            $dirName = "";
        header("Location: " .  "http://" . $_SERVER["HTTP_HOST"]
            . $dirName
            . "/" .  $target);
        if (!$noExit)
        {
            exit();
        }
    }
1091388
protected function makeRedirect($url)
    {
        $redirect = new RedirectResponse($url);
        $redirect->setSession($this->session);
        $redirect->setInput($this->input);

        return $redirect;
    }
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);
    }
505819
public function redirectTo($location) {
        $app = $GLOBALS['app'];
        $host = $_SERVER['HTTP_HOST'];
        if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {
            $host = $_SERVER['HTTP_X_FORWARDED_HOST'];
        }
        $protocol = isset($_SERVER['HTTPS'])?'https://':'http://'; 
        $redirectLocation = $protocol.$host.'/'.$app->getConfiguration()->getApplicationContext().'/'.$location;
        if ($app->getSubject()->isAuthenticated()) {
            $separator = '?';
            if(strpos($redirectLocation, '?'))
                $separator = '&';
            $redirectLocation .= $separator."rand_token=".urlencode($app->getSessionManager()->getActiveSession()->getAttribute('nonce'));
        }
        if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && 
            strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
                $this->addHeader("Content-type: application/json");
                $response = array();
                $response['redirect'] = $redirectLocation;
                echo json_encode($response);
                exit;
        } else {
            $this->addHeader('Location: '.$redirectLocation);
        }
    }
1359539
public static function redirect(string $to) {
		ref\sanitize::url($to);

		unset($_POST);
		unset($_GET);
		unset($_REQUEST);

		if (! \headers_sent()) {
			\header("Location: $to");
		}
		else {
			echo "<script>top.location.href='" . \str_replace("'", "\'", $to) . "';</script>";
		}
		exit;
	}
832383
protected function checkCategoryRedirect(Location $location): ?RedirectResponse
    {
        $content = $location->content;

        $internalRedirectContent = null;
        if (!$content->getField('internal_redirect')->isEmpty()) {
            $internalRedirectContent = $content->getFieldRelation('internal_redirect');
        }

        $externalRedirectValue = $content->getField('external_redirect')->value;

        if ($internalRedirectContent instanceof Content) {
            if ($internalRedirectContent->contentInfo->mainLocationId !== $location->id) {
                return new RedirectResponse(
                    $this->router->generate($internalRedirectContent),
                    RedirectResponse::HTTP_MOVED_PERMANENTLY
                );
            }
        } elseif ($externalRedirectValue instanceof UrlValue && !$content->getField('external_redirect')->isEmpty()) {
            if (mb_stripos($externalRedirectValue->link, 'http') === 0) {
                return new RedirectResponse($externalRedirectValue->link, RedirectResponse::HTTP_MOVED_PERMANENTLY);
            }

            return new RedirectResponse(
                $this->router->generate($this->getRootLocation()) . trim($externalRedirectValue->link, '/'),
                RedirectResponse::HTTP_MOVED_PERMANENTLY
            );
        }

        return null;
    }
1079219
private function doWhere($where, $type)
    {

        switch ($type) {

            case 'and':

                $where = $this->useBuilder('where')
                    ->where($where, $this->getCield());

                break;

            case 'or':

                $where = $this->useBuilder('where')
                    ->orWhere($where, $this->getCield());

                break;
        }

        $this->string['where'] = $where['content'];
        $this->string['parameters'] = array_merge($this->string['parameters'], $where['array']);
    }
400690
public function redirectToRoute($route, array $params = [], $permanent = false)
    {
        $map = $this->app()->getRouteMap();
        $url = $map->assemble($route, $params);

        return $this->redirect($url, $permanent);
    }
1207646
protected function where($where)
    {
        foreach($where as $field => $value) {
            $this->queryBuilder->where($field, $value);
        }
    }
833560
protected function fixSql($where)
    {
        if ($where == parent::NO_MATCH_SQL) {
            return parent::MATCH_ALL_SQL;
        } elseif ($where == parent::MATCH_ALL_SQL) {
            return parent::NO_MATCH_SQL;
        } else {
            return "NOT ($where)";
        }
    }