public static function getItemByUrl($items, $url)
    {
        if (!isset($items)) {
            return null;
        }

        // Check for the exact rule
        if (array_key_exists("/" . $url, $items)) {
            return $items["/" . $url];
        }

        $urlParts = explode("/", trim($url, "/"));
        $urlPartsLen = count($urlParts);

        while ($urlPartsLen > 0) {
            unset($urlParts[--$urlPartsLen]);

            $subUrl = "/" . join("/", $urlParts);

            // Use the higher level rule, if it doesn't have deactivated recursive application
            if (array_key_exists($subUrl, $items)
                && (!isset($items[$subUrl]["recursive"])
                        || $items[$subUrl]["recursive"]===true)) {
                return $items[$subUrl];
            }
        }

        return null;
    }