Posted By

traeregan on 09/25/10


Tagged

php ci codeigniter baseurl subdirectory Basedir install-path


Versions (?)

Auto-Determine Subdirectory of Install Path, If Any


 / Published in: PHP
 

  1. // Auto-Determine Subdirectory of Install Path, If Any
  2. // If Not Present, Will Result in /
  3.  
  4. $slash = explode('/', getenv("SCRIPT_NAME"));
  5. $current_filename = $slash[count($slash) - 1];
  6. $host_url = str_replace($current_filename, "", getenv("SCRIPT_NAME"));
  7.  
  8. // e.g. usage
  9.  
  10. $config['base_url'] = "http://". $_SERVER['HTTP_HOST'].$host_url;

Report this snippet  

You need to login to post a comment.