I have this:
$route['(:any)'] = "front/$1"; // front
$route['admin/(:any)'] = "admin/$1"; // admin
i want to make url like this:
mysite.com/en/somecontroller/somemethod
mysite.com/ru/somecontroller/somemethod
etc...
i guess something like this:
$route['(:any)'] = "front/$1"; // front
$route['(:any)/(:any)'] = "front/$2";
$route['admin/(:any)'] = "admin/$1"; // admin
$route['(:any)/admin/(:any)'] = "admin/$2";
but I get errors when the first segment is language, CI thinks that is a controller
If you are using CodeIgniter's language class , then this URI Language Identifier class extension should do exactly what you want.
This language class extension allows you to automatically prefix all site urls with a language abbreviation that is pre-defined in your config file or from a link and automatically load the corresponding language translation file, the route will then be corrected by the route regex for everything to work as normal.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.