I have created a folder as user in the root directory.
My project base path is:
/var/www/myproject/
When I want to access the base
use base_url()
base_url()
echo $baseurl=base_url();
if you need to pass url to a function then use site_url()
site_url()
echo site_url('controller/function');
if you need the root path then FCPATH..
FCPATH
echo FCPATH;