CodeIgniter Forums

Full Version: Multiple Urls to one default controller
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[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

El Forum

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

El Forum

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