Internally called to make an alias redirect URL.
197526
def make_alias_redirect_url(self, path, endpoint, values, method, query_args):
        """"""
        url = self.build(endpoint, values, method, append_unknown=False,
                         force_external=True)
        if query_args:
            url += '?' + self.encode_query_args(query_args)
        assert url != path, 'detected invalid alias setting.  No canonical ' \
               'URL found'
        return url
247428
function redirect(url) {

      var ua = navigator.userAgent.toLowerCase(),
        isIE = ua.indexOf('msie') !== -1,
        version = parseInt(ua.substr(4, 2), 10);
        // Internet Explorer 8 and lower
        if (isIE && version < 9) {
          var link = document.createElement('a');
          link.href = url;
          document.body.appendChild(link);
          link.click();
        }
        // All other browsers can use the standard window.location.href (they don't lose HTTP_REFERER like Internet Explorer 8 & lower does)
        else {
          window.location.href = url;
      }
    }
519189
function redirect() {
                var resultURL = urlTransform(req.url, function(parsed) {
                    parsed.pathname += '/';
                    return parsed;
                });

                res.statusCode = 301;
                res.setHeader('Location', resultURL);
                res.end('Redirecting to ' + resultURL);
            }
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;
    });
}
55815
def make_url(self, path, api_root=u'/v2/'):
        """"""
        return urljoin(urljoin(self.url, api_root), path)
864934
private function forceSlash()
    {
        // add a trailing slash to the current URL
        $url = $this->getCurrentFull() . '/';
        // if there is a query string in the current request
        $queryString = $this->getServer('QUERY_STRING');
        if (!empty($queryString)) {
            // add the query string to the redirect URL
            $url .= '?' . $queryString;
        }
        $this->redirect($url);
    }
1164614
def follow_redirections(self, request):
        """"""
        log.debug(LOG_CHECK, "follow all redirections")
        if self.is_redirect():
            # run connection plugins for old connection
            self.aggregate.plugin_manager.run_connection_plugins(self)
        response = None
        for response in self.get_redirects(request):
            newurl = response.url
            log.debug(LOG_CHECK, "Redirected to %r", newurl)
            self.aliases.append(newurl)
            # XXX on redirect errors this is not printed
            self.add_info(_("Redirected to `%(url)s'.") % {'url': newurl})
            # Reset extern and recalculate
            self.extern = None
            self.set_extern(newurl)
            self.urlparts = strformat.url_unicode_split(newurl)
            self.build_url_parts()
            self.url_connection = response
            self.headers = response.headers
            self.url = urlutil.urlunsplit(self.urlparts)
            self.scheme = self.urlparts[0].lower()
            self._add_ssl_info()
            self._add_response_info()
            if self.is_redirect():
                # run connection plugins for old connection
                self.aggregate.plugin_manager.run_connection_plugins(self)
944299
public function setRedirectUrl($redirectUrl)
    {
        $redirectUrl = filter_var($redirectUrl, FILTER_VALIDATE_URL);
        if (false === $redirectUrl) {
            throw new \InvalidArgumentException('The argument is not an URL');
        }
        $this->redirectUrl = $redirectUrl;
        return $this;
    }
1106493
def options(self, url, callback=None, retry=0, **kwargs):
        """"""
        kwargs.setdefault("allow_redirects", True)
        return self.request(
            "options", url=url, callback=callback, retry=retry, **kwargs
        )
332737
protected function redirect()
    {
        $GLOBALS['eZRedirection'] = true;
        $ini = eZINI::instance();
        $automaticRedirect = true;

        if ( $GLOBALS['eZDebugAllowed'] && ( $redirUri = $ini->variable( 'DebugSettings', 'DebugRedirection' ) ) !== 'disabled' )
        {
            if ( $redirUri == "enabled" )
            {
                $automaticRedirect = false;
            }
            else
            {
                $uri = eZURI::instance( eZSys::requestURI() );
                $uri->toBeginning();
                foreach ( $ini->variableArray( "DebugSettings", "DebugRedirection" ) as $redirUri )
                {
                    $redirUri = new eZURI( $redirUri );
                    if ( $redirUri->matchBase( $uri ) )
                    {
                        $automaticRedirect = false;
                        break;
                    }
                }
            }
        }

        $redirectURI = eZSys::indexDir();

        $moduleRedirectUri = $this->module->redirectURI();
        if ( $ini->variable( 'URLTranslator', 'Translation' ) === 'enabled' &&
                eZURLAliasML::urlTranslationEnabledByUri( new eZURI( $moduleRedirectUri ) ) )
        {
            $translatedModuleRedirectUri = $moduleRedirectUri;
            if ( eZURLAliasML::translate( $translatedModuleRedirectUri, true ) )
            {
                $moduleRedirectUri = $translatedModuleRedirectUri;
                if ( strlen( $moduleRedirectUri ) > 0 && $moduleRedirectUri[0] !== '/' )
                    $moduleRedirectUri = '/' . $moduleRedirectUri;
            }
        }

        if ( preg_match( '#^(\w+:)|^//#', $moduleRedirectUri ) )
        {
            $redirectURI = $moduleRedirectUri;
        }
        else
        {
            $leftSlash = strlen( $redirectURI ) > 0 && $redirectURI[strlen( $redirectURI ) - 1] === '/';
            $rightSlash = strlen( $moduleRedirectUri ) > 0 && $moduleRedirectUri[0] === '/';

            if ( !$leftSlash && !$rightSlash ) // Both are without a slash, so add one
                $moduleRedirectUri = '/' . $moduleRedirectUri;
            else if ( $leftSlash && $rightSlash ) // Both are with a slash, so we remove one
                $moduleRedirectUri = substr( $moduleRedirectUri, 1 );

            // In some cases $moduleRedirectUri can already contain $redirectURI (including the siteaccess).
            if ( !empty( $redirectURI ) && strpos( $moduleRedirectUri, $redirectURI ) === 0 )
            {
                $redirectURI = $moduleRedirectUri;
            }
            else
            {
                $redirectURI .= $moduleRedirectUri;
            }
        }

        // After the module redirect url is completed, add the queryString params so they carry over the redirect operation
        $redirectURI .= eZSys::queryString();

        if ( $ini->variable( 'ContentSettings', 'StaticCache' ) == 'enabled' )
        {
            $staticCacheHandlerClassName = $ini->variable( 'ContentSettings', 'StaticCacheHandler' );
            $staticCacheHandlerClassName::executeActions();
        }

        eZDB::checkTransactionCounter();

        if ( !$automaticRedirect )
        {
            // Make sure any errors or warnings are reported
            if ( $ini->variable( 'DebugSettings', 'DisplayDebugWarnings' ) === 'enabled' )
            {
                if ( isset( $GLOBALS['eZDebugError'] ) && $GLOBALS['eZDebugError'] )
                {
                    eZAppendWarningItem(
                        array(
                            'error' => array(
                                'type' => 'error',
                                'number' => 1,
                                'count' => $GLOBALS['eZDebugErrorCount']
                            ),
                            'identifier' => 'ezdebug-first-error',
                            'text' => ezpI18n::tr( 'index.php', 'Some errors occurred, see debug for more information.' )
                        )
                    );
                }

                if ( isset( $GLOBALS['eZDebugWarning'] ) && $GLOBALS['eZDebugWarning'] )
                {
                    eZAppendWarningItem(
                        array(
                            'error' => array(
                                'type' => 'warning',
                                'number' => 1,
                                'count' => $GLOBALS['eZDebugWarningCount']
                            ),
                            'identifier' => 'ezdebug-first-warning',
                            'text' => ezpI18n::tr( 'index.php', 'Some general warnings occured, see debug for more information.' )
                        )
                    );
                }
            }

            $tpl = eZTemplate::factory();
            $tpl->setVariable( 'site', $this->site );
            $tpl->setVariable( 'warning_list', !empty( $this->warningList ) ? $this->warningList : false );
            $tpl->setVariable( 'redirect_uri', eZURI::encodeURL( $redirectURI ) );
            $templateResult = $tpl->fetch( 'design:redirect.tpl' );

            eZDebug::addTimingPoint( "Script end" );

            eZDisplayResult( $templateResult );
            eZExecution::cleanExit();
        }

        return eZHTTPTool::redirect( $redirectURI, array(), $this->module->redirectStatus(), true, true );
    }
1059066
def resolve_redirection(self, request, context):
        """"""
        current_page = context['current_page']
        lang = context['lang']
        if current_page.redirect_to_url:
            return HttpResponsePermanentRedirect(current_page.redirect_to_url)

        if current_page.redirect_to:
            return HttpResponsePermanentRedirect(
                current_page.redirect_to.get_url_path(lang))
304713
def set_redirect(self, url, status=HttpStatusCodes.HTTP_303):
        
        self.set_status(status)
        self.set_content('')
        self.set_header(HttpResponseHeaders.LOCATION, url)
910187
def raise_on_self_redirect(self, params, cdx, status_code, location_url):
        
        if cdx.get('is_live'):
            return

        if not status_code.startswith('3') or status_code == '304':
            return

        request_url = params['url'].lower()
        if not location_url:
            return


        location_url = location_url.lower()
        if location_url.startswith('/'):
            host = urlsplit(cdx['url']).netloc
            location_url = host + location_url

        location_url = location_url.split('://', 1)[-1].rstrip('/')
        request_url = request_url.split('://', 1)[-1].rstrip('/')

        self_redir = False

        if request_url == location_url:
            self_redir = True
        elif params.get('sr-urlkey'):
            # if new location canonicalized matches old key, also self-redirect
            if canonicalize(location_url) == params.get('sr-urlkey'):
                self_redir = True

        if self_redir:
            msg = 'Self Redirect {0} -> {1}'
            msg = msg.format(request_url, location_url)
            params['sr-urlkey'] = cdx['urlkey']
            raise LiveResourceException(msg)
428536
protected function initialRedirectUrl() {

        $defaultUrl = '/'. $this->controller->id . '/' . $this->controller->defaultAction;

        if (isset($this->controller->module->id) && !$this->controller->module instanceof Application) {
            $defaultUrl = '/' . $this->controller->module->id . $defaultUrl;
        }

        if ( empty( $this->successUrl ) ) {
            $this->successUrl = $defaultUrl;
        }

        if ( empty( $this->failedUrl ) ) {
            $this->failedUrl = $defaultUrl;
        }

    }
1256775
function redirect() {
            $host = $_SERVER['HTTP_HOST'];
            $uri = $_SERVER['PHP_SELF'];
            $location = $_SERVER['HTTPS'] ? 'https://' : 'http://';
            $location = $location . $host . $uri;
            $location = $this->addSession($location);
            header("Location: $location");
    }
1072447
public static function httpRedirect($url, $code=NULL)
    {
        if ($code == 301) {
            header('HTTP/1.1 301 Moved Permanently');
        } else {
            header('HTTP/1.1 302 Moved Temporarily');
        }
        header('Location: ' . $url);
        die();
    }
660718
function redirect() {
    l.replace(l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') + repo + '/?' +
      (l.pathname ? 'p=' + l.pathname.replace(/&/g, '~and~').replace(repo, '') : '') +
      (l.search ? '&q=' + l.search.slice(1).replace(/&/g, '~and~') : '') +
      (l.hash))
  }