Welcome Guest, Not a member yet? Register   Sign In
Remove Controller from URL
#1

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

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

[eluser]mihailt[/eluser]
same can be achived by using .htaccess file
#4

[eluser]TheFuzzy0ne[/eluser]
And doing it via htaccess might be marginally faster, although the difference in speed will probably be negligible.
#5

[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




Theme © iAndrew 2016 - Forum software by © MyBB