Welcome Guest, Not a member yet? Register   Sign In
Help with routes.php, please
#1

[eluser]indapublic[/eluser]
Hello, all.

I develop multi-language system. I use this solution but I need correction with routes.

My routes.php containg now:

Code:
$route['^(ru|en)/(.+)$'] = "$2";
$route['^(ru|en)$'] = $route['default_controller'];

and mysite.ru/ru/test and mysite.ru/en/test working correctly.

But I want too this behavior:

http://mysite.ru/test -> http://mysite.ru/{default language or language i will set}/test

How I do it?

Thank you
#2

[eluser]Aken[/eluser]
Use your .htaccess to redirect URLs that don't have the beginning language segment. That's what I'd do, at least. Maybe someone else can suggest something different.
#3

[eluser]indapublic[/eluser]
[quote author="Aken" date="1354683036"]Use your .htaccess to redirect URLs that don't have the beginning language segment. That's what I'd do, at least. Maybe someone else can suggest something different.[/quote]
Yep, it is possible. But I want to try use routes for this.

Update: I want to change default language dynamically, .htaccess don't help me with it.
#4

[eluser]Aken[/eluser]
Dynamically based on what?
#5

[eluser]indapublic[/eluser]
[quote author="Aken" date="1354686239"]Dynamically based on what?[/quote]
If user is logged, it will be language from user settings. If anonymous, it will be russian, for example
#6

[eluser]Aken[/eluser]
Best to use a MY_Controller or hook to do the logic and redirect before any other code has loaded.




Theme © iAndrew 2016 - Forum software by © MyBB