My Apache server has a problem when someone enters a URI like: "". (Note the extra slash.) The server executes the index.php script anyway, which causes the browser directory and the current directory used in the script to be different. And therefore my relative links don't work, and my stylesheet is not loaded. A quick test ("") reveals that also this site has this glitch.
When a client requests a directory without the last slash ("") the server sends a HTTP 301 (Moved Permanently) response with a redirect to the correct URI (""), and my idea was to do the same when the user adds a slash too much:
<?php
$req = $_SERVER['REQUEST_URI'];
$newReq = ereg_replace ('index.php[^?]*', 'index.php', $req);
if (strlen($newReq) < strlen($req)) {
header ('Location: '.$newReq);
header ('HTTP/1.0 301 Moved Permanently');
die; }
unset($req); unset($newReq);
... (rest of the script) ...
?>
Replace every occurence of 'index.php' with your filename and you're done. Hope it helps. :-)
(Note: I'm not using fragments in my URI's (like 'index.php#bottom'), and this code may not do what you want if you are using them.)