Remove Controller from the URI to keep URL Shorter - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Remove Controller from the URI to keep URL Shorter (/showthread.php?tid=24100) |
Remove Controller from the URI to keep URL Shorter - El Forum - 10-30-2009 [eluser]Unknown[/eluser] Hello. I want to keep the url's short and have this: www.example.com / function / ID so that by default my controller called Main will accept the functions. My question is: How can I do this so that I do not have to re-edit the routes.php file when I add another controller? e.g. in three months time I decide to add an Admin controller To add I have my Main controller accepting the functions currently. I'm doing the following which I found here Code: $route['^(?!exemptdomians|ezsell|login).*'] = "main/$0"; But this means I have to re-edit this in routes.php whenever I add a controller. many thanks if you can give any help! Remove Controller from the URI to keep URL Shorter - El Forum - 10-30-2009 [eluser]pistolPete[/eluser] You can either add the routes automatically: http://ellislab.com/forums/viewreply/261261/ Or you can extend the Router class and add that functionality there: http://ellislab.com/codeigniter/user-guide/general/creating_libraries.html |