How to create URL like "" www.domain.com/products/blue-shirts "" ? |
[eluser]Kiran K[/eluser]
Hi all, I am developing a e-commerce website and i wanted to show url like this "www.domain.com/products/blue-shirts" , how can i achieve this in Codeigniter ?? How can i map the url slug ("blue-shirts") to its unique ID in my product table. ? Please help me. Thanks. Kiran.
[eluser]CroNiX[/eluser]
This should help: http://ellislab.com/codeigniter/user-gui...#remapping http://ellislab.com/codeigniter/user-gui...uting.html
[eluser]CroNiX[/eluser]
Something like this would probably work /config/routes.php Code: $route['products/(:any)' = 'products/view/$1'; /controllers/products.php Code: class Products extends CI_Controller {
[eluser]CroNiX[/eluser]
Code: $route['products/(:any)' = 'products/view/$1'; Routes with the most segments need to come before those with fewer, like above. First route has 2 segments, "products/some-product" and the 2nd one only has 1, "products". So it should go in that order or the routing won't work properly. |
Welcome Guest, Not a member yet? Register Sign In |