diff --git a/jsonld.php b/jsonld.php index d746088..4a1f17c 100644 --- a/jsonld.php +++ b/jsonld.php @@ -1,7 +1,7 @@ 0) { - // do not count the last segment if it isn't a path (doesn't end in '/') - if(substr($base['normalizedPath'], -1) !== '/') { + // don't count the last segment if it isn't a path (doesn't end in '/') + // don't count empty first segment, it means base began with '/' + if(substr($base['normalizedPath'], -1) !== '/' || + $base_segments[0] === '') { array_pop($base_segments); } foreach($base_segments as $segment) {