Welcome Guest, Not a member yet? Register   Sign In
one index.php for multiple application
#5

(This post was last modified: 05-01-2015, 02:18 PM by CroNiX.)

Maybe just checking the server name would suffice. However, that won't work if you ever need to access the app via CLI, like to run a cron job, since $_SERVER won't exist. Never tried to do what you're attempting, so not sure how feasible this is.
PHP Code:
switch($_SERVER['SERVER_NAME'])
{
  case 
'app1.domain.com':
    
define('APP_DIR''application/app1');
    break;
  case 
'app2.domain.com':
    
define('APP_DIR''application/app2');
    break;
}

//Could not determine app to run, die
if ( ! defined('APP_DIR'))
{
  die(
'Could not determine app');
}

//If we got this far, set the $application_folder
$application_folder APP_DIR
Reply


Messages In This Thread
RE: one index.php for multiple application - by CroNiX - 05-01-2015, 02:14 PM



Theme © iAndrew 2016 - Forum software by © MyBB