i am currently coding in codeigniter and i want to remove the controller and function name from url so that only product slug is displayed in url.
currently my url is like
www.example.com/main/singlePage/41/product-slug
I want the url to be like
www.example.com/product-slug
2 Answers
We can use routes for that, In your application/config/routes.php.
See the example,
$route['{any}'] = 'pages/slug_on_the_fly'
Ref: https://codeigniter.com/user_guide/general/routing.html
1 Comment
Regolith
it is still not working. main is controller and singlePage is function.
$this->uri->segment(3)or41. You have to change your controller/model logic and search product bysluginstead searching byid. Then you can use URL without id in it.