Welcome Guest, Not a member yet? Register   Sign In
URL Routing by .htaccess or routes.php
#1

[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
#2

[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.




Theme © iAndrew 2016 - Forum software by © MyBB