I think the simplest thing to do is put a slash (and a path, if necessary) before the file name (index.php). For example, this file has a link to "/index.php" and it will link to
http://shoutbox.menthix.net/index.php no matter what folder it's in...
http://shoutbox.menthix.net/files/testing.html
quote:
Originally posted by leito.gt
echo $_SERVER['DOCUMENT_ROOT']
// But DOCUMENT_ROOT will echo the complete path, and not just the folder.
You should try this instead: dirname($_SERVER['PHP_SELF'])
If you're running the script
http://site.com/files/images/index.php, that code will return "/files/images"