I understand that there are three cases of routing:
Main:
/<controller>/<action>/<parameters>
Special for admin panel (where "admin" will be a kind of separate module):
/<module>/<controller>/<action>/<parameters>
And finally, a special case for "/ projects", which maps to "/ front / projects".
In this case, you need to make your routing class more flexible so that it can handle any routing scheme. In a framework such as Kohana, this will be done with rules such as:
Route::set('adminModule', 'admin/projects') ->defaults(array( 'controller' => 'projects', 'action' => 'admin', )); Route::set('projectPage', 'projects') ->defaults(array( 'controller' => 'front', 'action' => 'projects', )); Route::set('default', '(<controller>(/<id>(/<action>)))') ->defaults(array( 'controller' => 'index', 'action' => 'index', ));
Obviously, this is just an example, but you get the idea. Basically, you want to provide reasonable default routing (e.g. controller / action / id), but you should also allow users to configure other routes.
source share