Samo da dopunim:
Kôd:
//
// function url_root ()
// Return root level of site
// This works if function is called from script which is in the root of the site,
// or if script is included by other script which is in the root.
//
function url_root() {
$m_result = "http://" . $_SERVER['HTTP_HOST'] . str_replace('\\', '/', dirname ($_SERVER['SCRIPT_NAME']));
if (substr($m_result, -1,1) !== "/"){
$m_result .= '/';
}
return $m_result;
}
ne bi bio PHP to sto jeste da je kozistentan

Razlicito tretira root url i poddirektorijume tako da je moralo jos malo koda da se doda.
Imas srece sto se i ja bas bakcem sa istim problemom. Ideja sa <base href= > koja je izneta ovde mi se bas potrefila tako da mi je sad stvar mnogo jednostavnije od umetanja apsolutnih putanja za ama bas sve na strani.