CodeIgniter Forums
Multiple Urls to one default controller - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: Multiple Urls to one default controller (/thread-28450.html)



Multiple Urls to one default controller - El Forum - 03-11-2010

[eluser]Unknown[/eluser]
I have a newbie question here.
I have a website that right now only has two products and I want one controller to handle all requests for the products.
What I need is for http://localhost/eggs/ or http://localhost/bacon to go to the products controller (function index). Then I can return a different product through my model based on $this->uri->segment(1)

I understand how to do it if I were to use this convention http://localhost/products/eggs but I do not want to add that extra uri segment in there.

Thanks,
Stewy


Multiple Urls to one default controller - El Forum - 03-11-2010

[eluser]kirkaracha[/eluser]
Have a controller called "products" and use URI Routing to take "products" out of the URL.


Multiple Urls to one default controller - El Forum - 03-11-2010

[eluser]Unknown[/eluser]
I knew there was a simple way. Thanks for pointing me in the right direction.