CodeIgniter default controller in a sub directory not working

前端 未结 9 1685
醉话见心
醉话见心 2020-11-29 10:15

My default_controller in the routes configuration is set as \"home.php\".

I have a sub directory for my controllers, lets call it \"folder\". So if I visit http://my

9条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-29 11:12

    For each sub-folder in your controllers folder you must specify a default controller in routes.php. The built in $route['default_controller'] will not work for sub-folders.

    e.g: For setting the default controller for you folder sub-folder to home add the following to your /application/config/routes.php file:

    $route['folder'] = "folder/home";
    

    which means http://mysite.com/folder/ is the same as http://mysite.com/folder/home as URL.

提交回复
热议问题