CodeIgniter Forums
How default is the default controller - 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: How default is the default controller (/showthread.php?tid=18653)



How default is the default controller - El Forum - 05-13-2009

[eluser]Unknown[/eluser]
Hello, all. I've been scouring these forums for some time to find the answer to my issue. I can't find it so I'm asking.

I have a controller called Main set as my default controller. When I'm at my sites index, the index of this controller gets called (that works). I thought that I could then call other methods from this default controller as well. For example, if I were to call example.com/page it would call the page method of the Main controller.

Is this correct? I can only seem to get this by calling to whole thing ( example.com/main/page ). This seems to defeat the purpose of being able to define a default controller.

I'm developing this on my iMac before uploading it to the server. I'm using MAMP to test it (it's like XAMPP).

Thanks in advance!

Cheers,
Bryan


How default is the default controller - El Forum - 05-13-2009

[eluser]Dam1an[/eluser]
What it means by default controller, is the one that gets called if you don't specify one (aka no uri segments)
You can achevie what you want using routes (reroute page to go via main/page)


How default is the default controller - El Forum - 05-13-2009

[eluser]Unknown[/eluser]
Thanks! It worked perfect!

Cheers,
Bryan