Check if the Error and its associated Redirection exists, then increase the counter of the Error|Redirection.

@param Redirection|null $redirection
@param Error404|null    $error404

@throws NoResultException

@return Redirection|Error404
437895
public function handleError($redirection, $error404)
    {
        if ($redirection) {
            $this->increaseCounter($redirection);

            return $redirection;
        } elseif ($error404) {
            $this->increaseCounter($error404);

            return $error404;
        }

        throw new NoResultException();
    }
1241935
public static function temporaryRedirect($url, $externalRedirect = false) {
		/** @var Response $response */
		$response = new static();
		$response->redirect($url, $externalRedirect, self::HTTP_TEMPORARY_REDIRECT);
		return $response;
	}
261268
static function redirectRequest($default_inner_url='') {
        $return_url = self::getRequest()->getParameter('return');
        if($return_url){
            if(substr($return_url, 0,1)=='/'){
                $url = $return_url;
            }else{
                $url = '/';
            }
        }else{
            $url = self::innerUrl2OuterUrl($default_inner_url);
        }
        self::redirectOut($url);
    }
136833
public function create(Redirect &$redirect)
    {
        $endpoint = '/admin/redirects.json';
        $data = $redirect->exportData();
        $response = $this->request(
            $endpoint, "POST", array(
            'redirect' => $data
            )
        );
        $redirect->setData($response['redirect']);
    }
775723
private function runCommand(string $command, string $redirect = '2>&1')
    {
        $pd = popen($command . ' ' . $redirect, 'r');
        if (false === $pd) {
            throw new \RuntimeException('Can not execute ' . $command);
        }

        return $pd;
    }
1087528
public function setRedirectUrl($redirectUrl)
    {

        if (!$this->getUrlValidator()->isValid($redirectUrl)) {
            throw new InvalidArgumentException('URL provided is invalid');
        }

        $this->redirectUrl = $redirectUrl;
    }
1273570
protected function generateErrorRedirect(BaseForm $form = null)
    {
        if (null !== $url = $this->retrieveErrorUrl($form)) {
            return $this->generateRedirect($url);
        }

        return null;
    }
303690
public function incrementHitCount(RedirectInterface $redirect)
    {
        try {
            $this->redirectRepository->incrementHitCount($redirect);
        } catch (\Exception $exception) {
            $this->_logger->logException($exception);
        }
    }
1216239
public function redirectByUrl($defaultRedirect = null, $key = null) {
		$redirectUrl = $this->getRedirectUrl($defaultRedirect, $key);

		return $this->_controller->redirect($redirectUrl);
	}
394391
protected function verifyRedirect($redirectUrl, $options)
    {
        if (strlen($redirectUrl) > 2048) {
            throw new \Exception('Too long redirectUrl argument passed');
        }
        if ($redirectUrl !== '') {
            // The below check is to prevent possible redirect attack
            // (if someone tries to redirect user to another domain).
            $uri = new Uri($redirectUrl);
            if (!$uri->isValid() || $uri->getHost() !== null) {
                throw new \Exception('Incorrect redirect URL: ' . $redirectUrl);
            }
            $options = ArrayUtils::merge($options, ['query' => ['redirect' => $redirectUrl]]);
        }
        return $options;
    }
247153
public function redirectWithError( $iErrorCode, $sController = 'order' )
    {
        $sErrorMessage = $this->getErrorByCode( $iErrorCode );

        // Set error
        $oEx = oxNew( 'oxExceptionToDisplay' );
        $oEx->setMessage( $sErrorMessage );
        oxRegistry::get( "oxUtilsView" )->addErrorToDisplay( $oEx, false );

        // Redirect (refresh page)
        $sUrl = $this->getConfig()->getShopCurrentUrl() . "cl=" . $sController;
        $sUrl = oxRegistry::get( "oxUtilsUrl" )->processUrl( $sUrl );
        oxRegistry::getUtils()->redirect( $sUrl );

        return;
    }
1043001
private function searchRedirect(): void
    {
        // calculated depend of language
        $pathway = $this->getPathInfo();
        /** @var array $routing */
        $routing = App::$Properties->getAll('Routing');

        if (!Any::isArray($routing) || !isset($routing['Redirect']) || !Any::isArray($routing['Redirect'])) {
            return;
        }

        // check if source uri is key in redirect target map
        if (array_key_exists($pathway, $routing['Redirect'])) {
            $target = $this->getSchemeAndHttpHost(); // . $this->getBasePath() . '/' . rtrim($routing['Redirect'][$pathway], '/');
            if ($this->getBasePath() !== null && !Str::likeEmpty($this->getBasePath())) {
                $target .= '/' . $this->getBasePath();
            }
            $target .= rtrim($routing['Redirect'][$pathway], '/');
            $redirect = new RedirectResponse($target);
            $redirect->send();
            exit();
        }
    }
1232721
protected function incrementHitCount(array $redirectRecord)
    {
        // Track the hit if not disabled
        if (!GeneralUtility::makeInstance(Features::class)->isFeatureEnabled('redirects.hitCount') || $redirectRecord['disable_hitcount']) {
            return;
        }
        $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
            ->getQueryBuilderForTable('sys_redirect');
        $queryBuilder
            ->update('sys_redirect')
            ->where(
                $queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($redirectRecord['uid'], \PDO::PARAM_INT))
            )
            ->set('hitcount', $queryBuilder->quoteIdentifier('hitcount') . '+1', false)
            ->set('lasthiton', $GLOBALS['EXEC_TIME'])
            ->execute();
    }
1314814
private function getError404RedirectionForm(ErrorRedirection $redirection)
    {
        $action = $this->generateUrl('victoire_404_redirect', ['id' => $redirection->getError()->getId()]);

        $containerId = sprintf('#404-%d-item-container', $redirection->getError()->getId());

        return $this->createForm(RedirectionType::class, $redirection, [
            'method'      => 'POST',
            'action'      => $action,
            'containerId' => $containerId,
            'attr'        => [
                'v-ic-post-to' => $action,
                'v-ic-target'  => 'closest li',
            ],
        ]);
    }
274678
protected function redirectUserTo(string $namespace, string $path, ?string $redirect = null): string
    {
        return \handles($this->redirectUserPath($namespace, $path, $redirect));
    }
1115530
static public function redirect($routeFrom, $routeTo, $http_response_code = 302)
    {
        $closure = function($routeTo, $replace, $http_response_code) {
            Response::$redirectHeader = [$routeTo, $replace, $http_response_code];
        };
        self::$instance->register('GET', $routeFrom, $closure, null, [$routeTo, true, $http_response_code]);
    }
946674
public function errorMessage($message, $afterRedirect = false)
    {
        if ($afterRedirect) {
            $_SESSION['GlobalMessage']['error'] = $message;
        }

        if (!empty($this->template)) {
            $this->template->globalErrorMessage = $message;
        }
    }