Process custom routes in router->route section in config
more information in *routing* section of README.MD

@param string $url
@return string
960775
protected function processRoutes($url)
    {
        $routes = $this->config->get('routes', []);

        foreach ($routes as $from => $to) {
            $result = UrlHelper::routeParse($from, $to, $url);
            if (false !== $result && (empty($result->methods) || in_array($this->method, $result->methods, true))) {
                return $result->url;
            }
        }

        return $url;
    }
171208
protected function doRouteMatching($url)
    {
        $matches = array();
        foreach ($this->route_definitions as $name => $route) {
            if (preg_match($route['regex'], $url, $matches)) {
                $matches[0] = $name;
                return $matches;
            }
        }
        return false;
    }
1127440
public static function getPathFromURL($url)
	{
		$path = str_replace(self::getProtocolFromURL($url) . '://', '', $url);
		$path = str_replace(self::getDomainFromURL($url), '', $path);
		
		if($path == '') return '/';
		
		return $path;
	}
283127
private function fixUriParts($url)
    {
        $position = Str::strpos($url, '?') ?: Str::strpos($url, '#');

        if ($position === false) {
            return $url;
        }

        return Str::substr($url, 0, $position) . '/' . Str::substr($url, $position);
    }
298147
public function path($url) {
        $prefix = $this->config['url_prefix'];

        // If the url_prefix is absolute-path style but the url isn't, get only the
        // path from the URL before comparing against the prefix.
        if (preg_match('#^/#', $prefix) && preg_match('#^http#', $url)) {
            $url = parse_url($url, PHP_URL_PATH);
        }

        // Trim the prefix from the URL
        return substr($url, strlen($prefix));
    }
1348129
private function parseUrl($url)
    {
        $parsed = parse_url($url);

        if ((count($parsed) === 1)
            && isset($parsed['path'])
            && (0 === strpos($parsed['path'], '?') || false !== strpos($parsed['path'], '&'))
        ) {
            $parsed = array(
                'query' => $parsed['path']
            );

            return $parsed;
        }

        return $parsed;
    }
347777
public static function getDomainFromURL($url)
	{
		$url = str_replace(self::getProtocolFromURL($url) . '://', '', $url);
		
		return explode('/', $url)[0];
	}
881303
protected function getWebPage($url)
    {
        $curl = curl_init();

        curl_setopt($curl, CURLOPT_URL,            $url);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_HEADER,         false);
        curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
        $output = curl_exec($curl);
        curl_close($curl);

        return (string) $output;
    }
521959
protected function parseUrl($url, $parameters)
    {
        // If provided $url is a route name...
        if ($this->route->has($url)) {
            $url = $this->url->route($url, $parameters);
        } else {
            $url = $this->url->to($url, $parameters);
        }

        return $url;
    }
1107572
static public function uri($url)
    {
        $res = parse_url($url);
        $return['protocol'] = $res['scheme'];
        $return['host'] = $res['host'];
        $return['port'] = $res['port'];
        $return['user'] = $res['user'];
        $return['pass'] = $res['pass'];
        $return['path'] = $res['path'];
        $return['id'] = $res['fragment'];
        parse_str($res['query'], $return['params']);
        return $return;
    }
625961
public function getRoute($url = '', $fqr = true)
    {
        if (!is_array($url)) {
            if (strpos($url, 'http') === 0) {
                return $url;
            }

            if (strpos($url, '/') === 0) {
                return route($url);
            }

            $url = str_replace('index.php?', '', trim($url));
            $vars = array();
            parse_str($url, $vars);
            $url = $vars;
        }

        $parts = array();

        if (!isset($url['option'])) {
            $parts['option'] = AnRequest::get('get.option', 'cmd');
        }

        //if not view is set the set
        if (!isset($url['view'])) {
            $parts['view'] = AnRequest::get('get.view', 'cmd');

            //only try to set the layout if we are setting the view
            if (!isset($url['layout']) && AnRequest::has('get.layout')) {
                $parts['layout'] = AnRequest::get('get.layout', 'cmd');
            }
        }

        //carry format
        if (!isset($url['format']) && AnRequest::has('get.format')) {
            $parts['format'] = AnRequest::get('get.format', 'cmd');
        }

        foreach ($parts as $key => $value) {
            $url[$key] = $value;
        }

        //unset html format since it's a default
        if (isset($url['format']) && $url['format'] == 'html') {
            unset($url['format']);
        }

        //unset default lyout since it's a default
        if (isset($url['layout']) && $url['layout'] == 'default') {
            unset($url['layout']);
        }

        $parts = 'index.php?'.http_build_query($url);
        
        $route = $this->getService('application')->getRouter()->build($parts, $fqr);

        return $route;
    }
421831
protected static function processLinkUrl($linkUrl)
    {
        static $absRefPrefix = null;
        static $absRefPrefixLength = 0;
        $ret = $linkUrl;
        $tsfe = self::getTsfe();


        // Fetch abs ref prefix if available/set
        if ($absRefPrefix === null) {
            if (!empty($tsfe->tmpl->setup['config.']['absRefPrefix'])) {
                $absRefPrefix       = $tsfe->tmpl->setup['config.']['absRefPrefix'];
                $absRefPrefixLength = strlen($absRefPrefix);
            } else {
                $absRefPrefix = false;
            }
        }

        $absRefPrefixLengthTmp = $absRefPrefixLength; //makes sure we do not write back to static variable

        // remove abs ref prefix
        if ($absRefPrefix !== false && strpos($ret, $absRefPrefix) === 0) {
            $parsedUrl = parse_url($linkUrl);
            if ($parsedUrl !== false
                && $parsedUrl['path'] === $absRefPrefix
                && substr($absRefPrefix, -1) === '/'  //sanity check: must end with /
            ) {
                //for root pages: treat '/' like a suffix, not like a prefix => don't remove last '/' in that case!
                //This ensures that for an absRefPrefix = '/abc/' or '/' we return '/' instead of empty strings
                $absRefPrefixLengthTmp--;
            }

            $ret = substr($ret, $absRefPrefixLengthTmp);
        }

        return $ret;
    }
911962
public function getRoutePath($url = "") {
        if (isset($_SERVER['REDIRECT_QUERY_STRING']) && empty($url)) {
            $url = $_SERVER['REDIRECT_QUERY_STRING'];
        }
        if (isset($_SERVER['REQUEST_URI']) && empty($url)) {
            $url = $_SERVER['REQUEST_URI'];
        }
        if (isset($_SERVER['PATH_INFO']) && empty($url)) {
            $url = $_SERVER['PATH_INFO'];
        }
        return explode('/', trim($url, '/'));
    }
1170937
private function processURL($url) {

        // Clean up special characters in url params
        $url = str_replace("%20", " ", $url);

        // Store a private copy for use later
        $this->url = URLHelper::$testURL == null ? $url : URLHelper::$testURL;

        // Split it on protocol first if required.
        if (substr($url, 0, 4) == "http") {
            $splitProtocol = explode("://", $url);
            $requestSection = sizeof($splitProtocol) > 1 ? $splitProtocol [1] : $splitProtocol [0];
            $requestSection = substr($requestSection, strpos($requestSection, "/"));
        } else {
            $requestSection = $url;
        }
        $this->requestURI = $requestSection;

        // Now split it on question mark for query if required.
        $splitQuestionMark = explode("?", $requestSection);
        $queryStripped = $splitQuestionMark [0];

        // Now ensure no trailing or leading slash.
        if (substr($queryStripped, 0, 1) == '/') $queryStripped = substr($queryStripped, 1);
        if (substr($queryStripped, strlen($queryStripped) - 1) == '/') $queryStripped = substr($queryStripped, 0, strlen($queryStripped) - 1);

        // Now simply set the segments array to be the split on "/"
        $this->segments = explode("/", $queryStripped);

    }
940300
protected function formatUrl(string $url): string
    {
        return Str::startsWith($url, '/')
            ? $this->app['url']->to($url)
            : $url;
    }
256400
public function buildUrl(string $url): string
    {
        if (filter_var($url, FILTER_VALIDATE_URL)) {
            return $url;
        }
        return $this->endPoint . static::ENDPOINT_SUFFIX . $url;
    }
772736
public function getRedirect($url)
    {
        $pages = $this->getRedirects();
        $url = $this->normalizeUrl($url);

        if (isset($pages[$url])) {
            return $pages[$url];
        }
    }