Remove Controller from URL |
[eluser]bastones[/eluser]
I have seen a few CI projects that don't have the controller in the URL when going to specific methods, like instead of calling the controller like: domain.com/controller/method they only call domain.com/method and I'm sure this is possible some way? Cheers
[eluser]TheFuzzy0ne[/eluser]
Yes, it's possible. You set up a root, but you need to remember that there will potentially only be a sinle controller you can use, it will disabled any other controller that don't have routes added for them. Code: $route['(.+)'] = "some_controller/$1"; The above code is untested.
[eluser]TheFuzzy0ne[/eluser]
And doing it via htaccess might be marginally faster, although the difference in speed will probably be negligible.
[eluser]eoinmcg[/eluser]
Hi, I also needed to achieve the same effect in an app with several controllers. Check this thread for more info on extending the Router class: http://ellislab.com/forums/viewthread/107451/#541043 Hope this is of some help. Cheers, Eoin |
Welcome Guest, Not a member yet? Register Sign In |