I have sub directories under controllers folder like this:
controllers
--main
----home.php
----login.php
--admin
----home.php
----login.php
So how to make the default controller load main/home.php when entering "example.com" ?
As I read from this doc that I can't add a directory in $route['default_controller'] in CI 3. So I did this:
In config/routes.php
$route['default_controller'] = 'Home';
$route['Home'] = "main/home";
In config/config.php
$config['base_url'] = 'www.example.com';
$config['index_page'] = '';
.htaccess
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
So when I type example.com CI won't redirect me to main/home.php How can I fix this?