I modified my index.php and added this after the list of define()‘s that CI uses:
define('SERVERPATH', str_replace("index.php", "", $_SERVER['PHP_SELF']));
Based on the installation directory, SERVERPATH will equal the following:
http://localhost/test/index.php -> /test/
http://www.example.com/index.php -> /
Which is useful for me and probably a lot of users who do development on a localhost subdirectory and later upload to a real server.
My question is if there is a better way to do this, like if CI has this functionality built in without modifying a core file?
