CodeIgniter Forums
Dynamic routing, multilanguage uri - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Dynamic routing, multilanguage uri (/showthread.php?tid=54871)



Dynamic routing, multilanguage uri - El Forum - 09-28-2012

[eluser]Unknown[/eluser]
Hi, im doing a multi site using a very interesting library Urilang with this routes.php:
Code:
$route['(\w{2})/book'] = 'book';
$route['(\w{2})/user'] = 'user';

$route['(\w{2})/(:any)'] = 'page/page/$2';

$route['(\w{2})/(.*)'] = '$2';

$route['default_controller'] = "page";
$route['404_override'] = '';

$route['(\w{2})'] = $route['default_controller'];

Now works in this way: for example if you want to go to user page, go here
Code:
http://example.com/en/user
. What I'm trying to do is to catch the uri regardless if the lang string is there, if the visitor goes directly to user in this way
Code:
http://example.com/user
use the default language or if the user has been previously selected a language, redirect to the proper uri with the correct lang string, how can i do this using routing? or, theres another way to do this?

Thanks


Dynamic routing, multilanguage uri - El Forum - 09-29-2012

[eluser]keevitaja[/eluser]
try this one:

https://github.com/keevitaja/mci