mywebsite.com/it/moto/
should redirect to the home page. Hence i wrote this in routes.php
$route['(\w{2})/(auto|moto)/(.*)'] = '$3';
$route['(\w{2})/(auto|moto)'] = $route['default_controller'];
which works pretty good. Also, mywebsite.com/it/moto/mercatino
routes to Mercatino
controller, which is perfect.
No, i want this mywebsite.com/it/moto/mercatino/componenti-veicolo/221/molle-originali-r6
to route to this function inside Mercatino
controller
public function prodotto($category, $id, $title){
}
hence, i wrote this line in routes.php
$route['(mercatino|market){1}/(:any)/(:num)/(:any)'] = "mercatino/prodotto/$2/$3/$4";
But i get 404 Error. Any idea how to fix this?
$route['(mercatino|market){1}/(:any)/(:num)/(:any)'] = "mercatino/prodotto/$2/$3/$4";
How many directories are in "mercatino/prodotto/$2/$3/$4" ? By default codeigniter I think doesn't go into directory more than level 2.
What I mean is, when codeigniter look for files it assume that there can be only one more directory inside controller. So, if you have controllers/d1/file.php
you are fine but if you have controllers/d1/d2/file.php
it won't work with default behaviour of CI.
To make it work you will probably have to override the Router class
and fetch_directory
function or _validate_request
function may be.