getAbsolutePath(); if (strpos($path, $base) !== 0) { // The path doesn't start with the base path of the site... // Probably the path cannot be reached via URL. return null; } // remove initial path $path = str_replace($base, '', $path); // remove initial directory separator $path = preg_replace("/^[\/\\\\]/", '', $path); if (DIRECTORY_SEPARATOR === '\\') { // replace Windows DS $path = preg_replace("[\\\\]", '/', $path); } if ($relative) { return $path; } // rebuild URL return JUri::root() . $path; } }