Help with routes.php, please |
[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"; 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
[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.
[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.
[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
[eluser]Aken[/eluser]
Best to use a MY_Controller or hook to do the logic and redirect before any other code has loaded. |
Welcome Guest, Not a member yet? Register Sign In |