source/Core/Utils.php
public function redirect($sUrl, $blAddRedirectParam = true, $iHeaderCode = 302)
    {
        //preventing possible cyclic redirection
        //#M341 and check only if redirect parameter must be added
        if ($blAddRedirectParam && \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('redirected')) {
            return;
        }

        if ($blAddRedirectParam) {
            $sUrl = $this->_addUrlParameters($sUrl, ['redirected' => 1]);
        }

        $sUrl = str_ireplace("&amp;", "&", $sUrl);

        switch ($iHeaderCode) {
            case 301:
                $sHeaderCode = "HTTP/1.1 301 Moved Permanently";
                break;
            case 500:
                $sHeaderCode = "HTTP/1.1 500 Internal Server Error";
                break;
            case 302:
            default:
                $sHeaderCode = "HTTP/1.1 302 Found";
        }

        $this->_simpleRedirect($sUrl, $sHeaderCode);

        try { //may occur in case db is lost
            $this->getSession()->freeze();
        } catch (\OxidEsales\Eshop\Core\Exception\StandardException $exception) {
            \OxidEsales\Eshop\Core\Registry::getLogger()->error($exception->getMessage(), [$exception]);
            //do nothing else to make sure the redirect takes place
        }

        $this->showMessageAndExit('');
    }
public function redirect($sUrl, $blAddRedirectParam = true, $iHeaderCode = 302)
    {
        //preventing possible cyclic redirection
        //#M341 and check only if redirect parameter must be added
        if ($blAddRedirectParam && \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('redirected')) {
            return;
        }

        if ($blAddRedirectParam) {
            $sUrl = $this->_addUrlParameters($sUrl, ['redirected' => 1]);
        }

        $sUrl = str_ireplace("&amp;", "&", $sUrl);

        switch ($iHeaderCode) {
            case 301:
                $sHeaderCode = "HTTP/1.1 301 Moved Permanently";
                break;
            case 500:
                $sHeaderCode = "HTTP/1.1 500 Internal Server Error";
                break;
            case 302:
            default:
                $sHeaderCode = "HTTP/1.1 302 Found";
        }

        $this->_simpleRedirect($sUrl, $sHeaderCode);

        try { //may occur in case db is lost
            $this->getSession()->freeze();
        } catch (\OxidEsales\Eshop\Core\Exception\StandardException $exception) {
            \OxidEsales\Eshop\Core\Registry::getLogger()->error($exception->getMessage(), [$exception]);
            //do nothing else to make sure the redirect takes place
        }

        $this->showMessageAndExit('');
    }
public function redirect ( $ sUrl , $ blAddRedirectParam = true , $ iHeaderCode = 302 ) { //preventing possible cyclic redirection //#M341 and check only if redirect parameter must be added if ( $ blAddRedirectParam && \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'redirected' ) ) { return ; } if ( $ blAddRedirectParam ) { $ sUrl = $ this -> _addUrlParameters ( $ sUrl , [ 'redirected' => 1 ] ) ; } $ sUrl = str_ireplace ( "&amp;" , "&" , $ sUrl ) ; switch ( $ iHeaderCode ) { case 301 : $ sHeaderCode = "HTTP/1.1 301 Moved Permanently" ; break ; case 500 : $ sHeaderCode = "HTTP/1.1 500 Internal Server Error" ; break ; case 302 : default : $ sHeaderCode = "HTTP/1.1 302 Found" ; } $ this -> _simpleRedirect ( $ sUrl , $ sHeaderCode ) ; try { //may occur in case db is lost $ this -> getSession ( ) -> freeze ( ) ; } catch ( \ OxidEsales \ Eshop \ Core \ Exception \ StandardException $ exception ) { \ OxidEsales \ Eshop \ Core \ Registry :: getLogger ( ) -> error ( $ exception -> getMessage ( ) , [ $ exception ] ) ; //do nothing else to make sure the redirect takes place } $ this -> showMessageAndExit ( '' ) ; }
redirect user to the specified URL

@param string $sUrl               URL to be redirected
@param bool   $blAddRedirectParam add "redirect" param
@param int    $iHeaderCode        header code, default 302

@return null or exit
redirect user to the specified URL