<?php
$url = 'http://w...content-available-to-author-only...e.com/home/index.html';

$href = 'images/sunflower.png';
preg_match('~^(\.{0,2}\/)+~', $href, $matches);
if (substr_count($matches[0], '../')){
    echo 'Go up ' . substr_count($matches[0], '../') . ' directories';
}
else if (substr_count($matches[0], '/')){
    echo 'Base directory';
}
else {
    echo 'Relative directory';
}


?>