protected function setCurrentSiteInfo($host, $path)
    {
        $path = $this->formatPath($path);
        $currentSiteId = null;
        $currentLanguage = null;
        $currentAliasId = null;
        $matchingLength = -1;

        $matchingSites = $this->siteRepository->findByAliasDomain($host);

        /** @var ReadSiteInterface $site */
        foreach ($matchingSites as $site) {
            foreach ($site->getAliases() as $aliasId => $alias) {
                $aliasPrefix = $this->formatPath($alias->getPrefix());
                if ($host == $alias->getDomain() && strpos($path, $aliasPrefix) === 0) {
                    $splitLength = count(explode('/', $aliasPrefix));
                    if ($splitLength > $matchingLength) {
                        $currentSiteId = $site->getSiteId();
                        $currentLanguage = $alias->getLanguage();
                        $currentAliasId = $aliasId;
                        $matchingLength = $splitLength;
                    }
                }
            }
        }

        if (is_null($currentSiteId)) {
            throw new NonExistingSiteException();
        }

        $this->currentSiteManager->setSiteId($currentSiteId);
        $this->currentSiteManager->setLanguage($currentLanguage);

        $this->request->attributes->set('siteId', $currentSiteId);
        $this->request->attributes->set('_locale', $currentLanguage);
        $this->request->attributes->set('aliasId', $currentAliasId);
    }