public static function getFilePath($cwd, array $index)
    {
        $path = self::getRequestPath();

        if ($path === false) {
            return false;
        }

        $file = $cwd.$path;

        if (is_file($file)) {
            return $file;
        }

        if (empty($index)) {
            return false;
        }

        foreach ($index as $ext) {
            $f = rtrim($file, '/').'/index.'.$ext;

            if (is_file($f)) {
                return $f;
            }
        }

        return false;
    }