redirect to another URL
178072
function redirect(url, response) {
    const header  = {
        'Location': url
    };
    
    assert(url, 'url could not be empty!');
    assert(response, 'response could not be empty!');
    
    fillHeader(header, response);
    response.statusCode = MOVED_PERMANENTLY;
    response.end();
}
363772
def get_redirect_url(self, request, callback, parameters=None):
        """"""
        args = self.get_redirect_args(request, callback=callback)
        additional = parameters or {}
        args.update(additional)
        params = urlencode(args)
        return '{0}?{1}'.format(self.authorization_url, params)
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()
1281839
function (urlpath, dir) {
    var dirarr = dir.split('/');
    var url = /\/$/.test(urlpath) ? urlpath : urlpath + '/';
    dirarr.forEach(function (val) {
        addOneDir(url, val);
        redirectTo(url + val + '/');
        url += val;
    });
}
884573
function httpRedirect (url, code) {
    // default to 302 redirect code
    if (!code) {
        code = 302
    }
    // create new error
    var err = new Error('Redirect')
    err.code = code
    err.url = url
    // throw error which will be handled by application framework
    throw err
}
815888
public function redirect()
    {
        $http = eZHTTPTool::instance();
        $currentSiteAccess = eZSiteAccess::current();

        if ( $http->hasGetVariable( 'notmobile' ) )
        {
            setcookie( 'eZMobileDeviceDetect', 1, time() + (int)eZINI::instance()->variable( 'SiteAccessSettings', 'MobileDeviceDetectCookieTimeout' ), '/' );

            $http->redirect( eZSys::indexDir() );

            eZExecution::cleanExit();
        }

        if ( !isset( $_COOKIE['eZMobileDeviceDetect'] )
                && !in_array( $currentSiteAccess['name'], eZINI::instance()->variable( 'SiteAccessSettings', 'MobileSiteAccessList'  ) ) )
        {
            $currentUrl = eZSys::serverURL() . eZSys::requestURI();
            $redirectUrl = eZINI::instance()->variable( 'SiteAccessSettings', 'MobileSiteAccessURL' );

            // Do not redirect if already on the redirect url
            if ( strpos( $currentUrl, $redirectUrl ) !== 0 )
            {
                // Default siteaccess name needs to be removed from the uri when redirecting
                $uri = explode( '/', ltrim( eZSys::requestURI(), '/' ) );

                if ( array_shift( $uri ) == $currentSiteAccess['name'] )
                {
                    $http->redirect( $redirectUrl . '/' . implode( '/', $uri ) . eZSys::queryString() );
                }
                else
                {
                    $http->redirect( $redirectUrl . eZSys::requestURI() . eZSys::queryString() );
                }
            }

            eZExecution::cleanExit();
        }
    }
494381
function redirectToNext(req, res) {
  var redirectTo = req.session.next || '';
  req.session.next = null; // Null it so that we do not use it again.
  res.redirect(redirectTo);
}
1204797
function Request_redirect(url, isTemp) {
        logger.info('Request.redirect:', {
            url: url,
            isTemp: isTemp
        });
        this.addHeader('Location', url);
        this.stopPromiseChain();
        this.isRendered = true;
        if (Type.isBoolean(isTemp) && !!isTemp) {
            this.response.writeHead(302, this.headers);
        } else {
            this.response.writeHead(301, this.headers);
        }
        this.response.end('Redirect to:' + url);
    }
1210967
public static void redirect(HttpServletRequest request, HttpServletResponse response,
                               String url) throws IOException {
        String redirectUrl;

        if (url.startsWith("/")) {
            redirectUrl = request.getContextPath() + url;
        } else {
            redirectUrl = url;
        }

        logger.debug("Redirecting to URL: {}", redirectUrl);

        response.sendRedirect(redirectUrl);
    }
304713
def set_redirect(self, url, status=HttpStatusCodes.HTTP_303):
        
        self.set_status(status)
        self.set_content('')
        self.set_header(HttpResponseHeaders.LOCATION, url)
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);
    }
676057
def _get_redirect_url(self, request):
        
        if 'next' in request.session:
            next_url = request.session['next']
            del request.session['next']
        elif 'next' in request.GET:
            next_url = request.GET.get('next')
        elif 'next' in request.POST:
            next_url = request.POST.get('next')
        else:
            next_url = request.user.get_absolute_url()
        if not next_url:
            next_url = '/'
        return next_url
986913
function (urlpath, dirs) {
    dirs.forEach(function (val, idx) {
        redirectTo(urlpath, false);
        addDeepDir(urlpath, val);
    });
}
320870
function(req, params) {
    if(!params) {
      params = URL.parse(req.url, true).query;
    }
    var cconfig = this.config.client;
    var next = params.next || cconfig.default_redirection_url;
    var url = cconfig.base_url + next;
    return url;
  }
1081132
public function simpleRedirect()
    {
        global $wp;
        if (!$request = $wp->request) {
            return;
        }
        $currentSlug = add_query_arg(array(), $request);
        $post = get_page_by_title($currentSlug, 'OBJECT', 'custom-short-link');

        if (!$post) {
            return;
        }

        $fields = get_fields($post->ID);
        $redirectTo = null;

        // Find redirect url
        switch ($fields['custom_short_links_redirect_url_type']) {
            case 'external':
                $redirectTo = $fields['custom_short_links_redirect_to_external'];
                break;

            case 'internal':
                $redirectTo = $fields['custom_short_links_redirect_to_internal'];
                break;
        }

        // Make redirect with selected method
        switch ($fields['custom_short_links_redirect_method']) {
            case 'meta':
                add_action('wp_head', function () use ($fields, $redirectTo) {
                    echo '<meta http-equiv="refresh" content="' . $fields['custom_short_links_timeout'] . ';URL=' . $redirectTo . '">';
                });
                break;

            // 301 or 302
            default:
                wp_redirect($redirectTo, intval($fields['custom_short_links_redirect_method']));
                break;
        }
    }
1253338
def get_redirect_url(self, **kwargs):
        
        if self.request.REQUEST.has_key('next'): 
            return self.request.REQUEST.get('next')
        url = RedirectView.get_redirect_url(self, **kwargs)
        if url:
            return url
        return self.request.META.get('HTTP_REFERER')
812760
public function redirect($url='') {
		if(!preg_match('/^(?:\/|\\\\|\w:\\\\|\w:\/).*$/', $url) && !preg_match('/^[a-zA-Z0-9]*:\/\//', $url))#relative
			$url = $this->request->url->to($url);
		$this->setHeader('Location', $url);
		if($this->code === 200)
			$this->setCode(302);
		return $this;
	}