Ok, I am creating an admin interface for my custom blog at the url /admin.
Is it possible for me to be able to use the same includes (including autoload), as the roo
Easiest way would be to use absolute pathes / URLs.
For the URLs, define a constant/variable somewhere, that points to the root of your application, like :
define('ROOT_URL', 'http://www.example.com');
or
$root_url = 'http://www.example.com';
And use it in every link, like :
blah
This way, always OK (and the day you install your project on another server, or in a subdirectory, you only have one constant/variable to modify, and everything still works)
For includes / requires, always use absolute pathes too ; one solution is to use dirname, like this :
include dirname(__FILE__) . '/my_file.php';
include dirname(__FILE__) . '/../my-other-file.php';
__FILE__ is the current file, where you are writing this line ; dirname gets the path (the full path) to the directory containing that file.
With that, you never have to worry about the relative paths of your files.