1
votes

Problem is:

Controller: products Method: product_details(category_name, product_name)

Current URL is: http://www.domain.com/products/product_details/category-name/product-name

But i don't want the above url, I want to enter below URL and its remapped on the above mention method

URL TO MAPPED: http://www.domain.com/product/category-name/product-name

How to do it using routes.php in codeigniter?

1

1 Answers

2
votes

This should do the trick:

$route['products/(:any)/(:any)'] = 'products/product_details/$1/$2';

If your products controller has any other methods you will need to specify routes for them above this, as this is essentially a catch all route for your products controller.