CodeIgniter Forums
remove need to specify default_controller from URL altogether - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: remove need to specify default_controller from URL altogether (/showthread.php?tid=17133)



remove need to specify default_controller from URL altogether - El Forum - 03-26-2009

[eluser]ChrisBraddock[/eluser]
I'm wring a simple app with one controller ("application.php"). I want to get rid of having to reference it in the URL altogether, e.g. I'd like to be able to use hxxp://domain.com/function/ instead of hxxp://domain.com/application/function/.

I know I can use default_controller route to default requests of hxxp://domain.com to hxxp://domain.com/application, but I still cannot explicitly access functions without putting "application" in the URL.

Help!


remove need to specify default_controller from URL altogether - El Forum - 03-26-2009

[eluser]Jelmer[/eluser]
Take a look at routes, you need to add a rule like this:
Code:
$route['(:any)'] = 'application/$1';

More info in the User guide.


remove need to specify default_controller from URL altogether - El Forum - 03-26-2009

[eluser]ChrisBraddock[/eluser]
Working. Beautiful - thanks!