That is weird. It's because you'd need to add in '../' for each directory, and the trailing slash would make it think it was an extra directory. Maybe at the top you could have a function to count the slashes and make a string for the path, then use that in front of your links, ie,
//at the top
$path_info = explode("/", $REQUEST_URI);
$num_of_dirs = sizeof($path_info) - x; //x is how many directories there are before your script root (testsite)
$path_string = "";
for ($i=0; $i<$num_of_dirs; $i++) $path_string .= "../";
//in every link/img
echo "<img src=\"$path_stringimages/blah.jpg\">";
Please note that's just off the top of my head, i haven't got time to test it until tonight... let me know how it goes if you use it 🙂
The only other thing I can think of is to use full URLs for all the links and images, but that's going to be heavy on download time with too many images.
Hope that helps,
Jamie.