CodeIgniter Forums
URL Format - 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: URL Format (/showthread.php?tid=32058)



URL Format - El Forum - 07-12-2010

[eluser]GeXus[/eluser]
Hello, I have a basic e-commerce setup like this with a controller product.php, this gives me the following URL:

http://www.domain.com/product

To view a specific product, I now have:

http://www.domain.com/product/view/id

With a function within product.php called view. Is it possible to eliminate that? so the URL could just be http://www.domain.com/product/id ?

Thank you!


URL Format - El Forum - 07-12-2010

[eluser]WanWizard[/eluser]
you can use the _remap() method to capture all calls to the product controller (see the user guide).

Alternatively you can use a route that converts http://www.domain.com/product/id to http://www.domain.com/product/view/id, so you can leave your controller code as-is.


URL Format - El Forum - 07-12-2010

[eluser]GeXus[/eluser]
Awesome! The routes worked perfect, thank you! Smile