• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
set default controller in codeigniter 3

#1
How to set $route['default_controller'] if i have subfolder in controllers ?
My directory structure is
controllers
---backend
------Login.php
------Users.php
---frontend
------Login.php
------Register.php
------Home.php

setting $route['default_controller'] = 'backend/login';

it is not working.
Please help
Reply

#2
The default controller is meant to identify the controller and method to use if one isn't specified in a URI ... http://www.codeigniter.com/user_guide/ge...ved-routes

It is *not* meant to identify a subfolder!

In your case,
Code:
$route['default_controller'] = 'login';
tells CodeIgniter to use the Login controller in any subfolder accessed without specifying a controller, eg '/backend' or '/frontend'.

There has been lots of discussion about this on the forum, found by searching it...
http://forum.codeigniter.com/thread-6435...controller
http://forum.codeigniter.com/thread-6404...controller
http://forum.codeigniter.com/thread-6350...controller
http://forum.codeigniter.com/thread-6339...controller
and many more.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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