• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multi site with subfolders by subdomain

#1
Hi,

I'm trying to make a multi site with subfolder by subdomain, baut i'm having problems with default controller:

The directory escructure is:
application
  controllers
    mobile
      Home.php
    api
      Home.php
    desktop
      Home.php

And the code in router (that works in codeigniter 2.x) is the following:

PHP Code:
$hostParts explode('.'$_SERVER['HTTP_HOST']);
$subdomain $hostParts[0];
switch (
$subdomain) {
    case 'm':
        $controllersFolder 'mobile';
        $defaultController 'home';
        break;
    case 'api':
        $controllersFolder 'api';
        $defaultController 'home';
        break;
    default:
        $controllersFolder 'desktop';
        $defaultController 'home';
        break;
}

// defaults
$route['default_controller'] = $controllersFolder.'/'.$defaultController

I read something like that this works in codeigniter 2.x because is a bug, if this is the reason, what is the correct way to make it?

Greetings.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.