public function resolveRoute(Event $event, Router $router, $url) {
        if (PHP_SAPI === 'cli') {
            return;
        }

        $locales = $this->getLocales();
        $redirect = '/' . $this->getFallback()->getCode();
        $base = $router->base();

        // Double leading slashes redirect outside of host
        if ($base !== '/') {
            $redirect = $base . $redirect;
        }

        // Path doesn't start with a locale
        if (!preg_match('/^\/' . LocaleRoute::LOCALE . '\/(.*)?/', $url, $matches)) {

            // Check for locales that don't pass because of no ending slash
            if (empty($locales[trim($url, '/')])) {
                header('Location: ' . $redirect . $url);
                exit();
            }

        // Or if that locale is not supported
        } else if (empty($locales[$matches[1]])) {
            header('Location: ' . $redirect . $matches[2]);
            exit();
        }
    }