I want to change default controller URI Routing Codeigniter to this here is my code :
from->
$route['default_controller'] = 'home';
to->
$route['default_controller'] = 'Home_controller/home';
with this I have store class Home_controller in folder controller/public
thank for your help !!!
I don't really know and understand why you use the folder public
inside the folder of controllers
and i strongly disagree with that if you don't know the purpose of this.
In this case you should change your base_url
in application/config/config.php
to:
$config['base_url'] = 'http://YOUR_DOMAIN/public/';
Otherwise, try to set your route as:
$route['default_controller'] = 'public/Home_controller/home';
If you definitely need the public
folder inside controllers
, because you have another folder inside controllers
, comment me and i will suggest you another generic solution.
From docs :
You can NOT use a directory as a part of this setting!
Instead, if it can fit your requirements, you can set default controller in controllers
directory like Home.php
and put redirection in index
method to your wanted route.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.