How to Remove Index from URL - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: How to Remove Index from URL (/showthread.php?tid=51146) |
How to Remove Index from URL - El Forum - 04-22-2012 [eluser]pdxbenjamin[/eluser] Yes yes, I know how to remove it from the root directory using .htaccess that works fine. Code: <IfModule mod_rewrite.c> However, I've created a new folder in my views /views/roll/ I'm trying to organize my code a bit better in folders. In the controller called roll.php i've made a few functions starting out with index(). I'm trying to grab the username ie, http://site.com/roll/jdoe Code: function index() But, to do that the url is http://site.com/roll/index/jdoe How do I get the .htaccess to remove that INDEX? Thanks. How to Remove Index from URL - El Forum - 04-22-2012 [eluser]Samus[/eluser] You don't. index is a method in your controller so it is displayed as every other url is. siteurl.com/controller/method/param1/param2 If you don't want the index to appear in your url use routes. http://ellislab.com/codeigniter/user-guide/general/routing.html e.g Code: $route['roll/(:any)'] = "roll/index/$1"; How to Remove Index from URL - El Forum - 04-22-2012 [eluser]pdxbenjamin[/eluser] Ahhhhhh Thank you. I always forget about Routes |