core-bundle/src/Routing/RouteProvider.php
private function getAliasCandidates(string $pathInfo): array
    {
        $pos = strpos($pathInfo, '/');

        if (false === $pos) {
            return [$pathInfo];
        }

        /** @var Config $config */
        $config = $this->framework->getAdapter(Config::class);

        if (!$config->get('folderUrl')) {
            return [substr($pathInfo, 0, $pos)];
        }

        $candidates = [$pathInfo];

        while ('/' !== $pathInfo && false !== strpos($pathInfo, '/')) {
            $pathInfo = \dirname($pathInfo);
            $candidates[] = $pathInfo;
        }

        return $candidates;
    }
private function getAliasCandidates(string $pathInfo): array
    {
        $pos = strpos($pathInfo, '/');

        if (false === $pos) {
            return [$pathInfo];
        }

        /** @var Config $config */
        $config = $this->framework->getAdapter(Config::class);

        if (!$config->get('folderUrl')) {
            return [substr($pathInfo, 0, $pos)];
        }

        $candidates = [$pathInfo];

        while ('/' !== $pathInfo && false !== strpos($pathInfo, '/')) {
            $pathInfo = \dirname($pathInfo);
            $candidates[] = $pathInfo;
        }

        return $candidates;
    }
Compiles all possible aliases by applying dirname() to the request (e.g. news/archive/item, news/archive, news).

@return string[]