protected function getExcludedURLSegments()
    {
        $excludes = [];

        // Build from rules
        foreach (Director::config()->get('rules') as $pattern => $rule) {
            $route = explode('/', $pattern);
            if (!empty($route) && strpos($route[0], '$') === false) {
                $excludes[] = strtolower($route[0]);
            }
        }

        // Build from base folders
        foreach (glob(Director::publicFolder() . '/*', GLOB_ONLYDIR) as $folder) {
            $excludes[] = strtolower(basename($folder));
        }

        $this->extend('updateExcludedURLSegments', $excludes);
        return $excludes;
    }