My folder structure is as following
admin
__master
_______address_book
_______Users
_______Product
_______etc
__operations
_______register_orders
_______payments
_______etc
I have created controllers for address_book,users,products,register_orders, payments etc to reduce the complexity of each controller.
Now, how to handle index page request for www.abc.com/admin ? I have created Admin controller in /controllers directory then other links like www.abc.com/admin/master/address_book will not work.
How to handle both requests? I would also like to know is there any way to handle each index page requests eg:
www.abc.com/admin/
www.abc.com/admin/master/
www.abc.com/admin/operations/
To access each request with url like-
you have to use
codeigniter'srouting. And for routing there are aconfigfile underaplication/configfolder namedroutes.php. Add all your routes in this file. Suppose you want to access this url-then you have to create a new route for this in the
route file, like-where in
$routearray index you have to mention what will be the url and the value against this index you have to mention the controller'spathand also you can mention the controller'sfunctionname which will be invoked (forindexfunction there no need for mentioning).