URL Routing by .htaccess or routes.php - 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: URL Routing by .htaccess or routes.php (/showthread.php?tid=4535) |
URL Routing by .htaccess or routes.php - El Forum - 11-30-2007 [eluser]Gavin Vickery[/eluser] Hello, I'm working on a small app that only has one controller, but several smaller functions within it. By default, CI shows the controller name in the URL. I would like to always use this one controller by default, and only show the function names. Example: Controller: main Function (within main): find URL: http://example.com/find (NOT: http://example.com/main/find) I've got this working via my .htaccess file Code: RewriteRule ^(.*)$ /if/index.php/main/$1 [L] But I don't know if this is the best practice. Should I be using routes? If so, how would I go about doing that? Not sure I fully understand how routes or supposed to work. Cheers URL Routing by .htaccess or routes.php - El Forum - 11-30-2007 [eluser]Gavin Vickery[/eluser] This has been solved. Sorry, I was using the routes incorrectly with the wildcards (:any and :num). Works great now with the default .htaccess setup. |