How can I use sub-controller WITHOUT providing the directory name? |
I've read the docs and the forums, but I haven't yet figure out how to do this:
http://siteA.com/ControllerA/someMethod --> handled by Controllers/ControllerA http://siteB.com/ControllerB/someMethod --> handled by Controllers/SubDirectory/ControllerB Controllers --ControllerA.php --ControllerA1.php --SubDirectory ----ControllerB.php ----ControllerB1.php The typical solution is to access: http://siteA.com/SubDirectory/ControllerB/someMethod But I don't want to specify SubDirectory, esp. since the controller is to be accessed via a different domain. Note that this worked in CI 2.X Thanks!
With routes.
PHP Code: $route['someMethodA'] = 'subdirectory/ControllerA/someMethod'; http://yoursite.com/someMethodA would then actually trigger /application/controllers/subdirectory/ControllerA/someMethod. (08-06-2015, 07:15 AM)CroNiX Wrote: With routes. Thank you! That works - but seemingly not with default_controller... $route['default_controller'] = $isSiteB ? 'SubDirectory/ControllerB/index' : 'ControllerA'/index; Success: http://siteB.com/SubDirectory/ControllerB/index 404: http://siteB.com (expecting it to trigger SubDirectory/ControllerB/index) Suggestion? |
Welcome Guest, Not a member yet? Register Sign In |