remove index from url not index.php - 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 index from url not index.php (/showthread.php?tid=18478) |
remove index from url not index.php - El Forum - 05-07-2009 [eluser]Jagar[/eluser] Finally, somebody had posted some code that would allow one to use unlimited folders in the controllers folder, and since I have that I have removed many routings. Everything is excellent except when Ihave to pass a paramter to a function in the controller I need to include index such as: Code: http://localhost/admin/change_password/index/admin_1 Is there an easy way to remove that either through routing or any tricks that may do it. Thanks in advance. remove index from url not index.php - El Forum - 05-07-2009 [eluser]Dam1an[/eluser] Yeah you can do it using routes, such as Code: $route['admin/change_password/admin_1 '] = "admin/change_password/index/admin_1"; remove index from url not index.php - El Forum - 05-07-2009 [eluser]Jagar[/eluser] But there are many urls, that's the problem, I did that first and I was about to do it for all of them, but thought maybe there's a better way to do it, for all of them THanks remove index from url not index.php - El Forum - 05-07-2009 [eluser]Jagar[/eluser] I"m going to use routing, It doesn't seem so bad. Thanks for your reply by the way! remove index from url not index.php - El Forum - 05-08-2009 [eluser]Evil Wizard[/eluser] you could use _remap to force all requests for the controller to go through a specific method, removing the need to name the method in the URL and using something like... Code: public function _remap($strMethod='index') So only the name of the controller is required in the URL. remove index from url not index.php - El Forum - 05-08-2009 [eluser]Jagar[/eluser] I think I will go with routing. This is how I'm doing it now: Code: $route['admin/manage/(change_password|delete|change_status)/(.*)'] = "admin/manage/change_password/index/$1"; It seem to be working great. Thanks for your solution though |