Hi all, I am trying to make a multidomain setup of codeigniter.
I need to support links like this
www.site.com/users/username subdomain.site.com www.othersiteparkedonsite.com
in this 3 different cases i want to load application folder regarding the case
following code in index.php will work only with subdomain and domain case
// Application folder var
$myApp = '';
switch($_SERVER['HTTP_HOST'])
{
case 'site.com':
$myApp = 'application';
break;
default:
$myApp = str_replace('.','_',$_SERVER['HTTP_HOST']);
$myApp=str_replace('www_','',$myApp);
$myApp='sites/'.$myApp;
}
$application_folder = $myApp;
but how to identify the first case and subdomains????
Using the code up I can do with only one folder /sites/ in root folder and load by subdomain name or domain name the folder but , how to make routing , or with htaccess so that I can load application folder regarding the username,subdomain, domain ,and controller??? I mean I need, if we go to www.site.com/users/usernameX
index.php will load /usersites/usernameX folder
in case of subdomains from
sub1.site.com will load application folder
/subdomains/sub1_site_com
in case of other domain parked on the same folder
www.otherdomain.com will load
/sites/otherdomain_com
and
www.site.com/somecontroller/somefunction will work from the main /application folder which is in the root ...
Can you help me?