Welcome Guest, Not a member yet? Register   Sign In
language routing problem
#1

[eluser]september28[/eluser]
Hi there,

Had a quick scout around but couldn't find an answer in the forums...

I am having trouble getting the routing to work on my site. I am using the language library/helper thing from http://maestric.com/doc/php/codeigniter_i18n

Routes are all working fine, but now I want to add another route that redirects 'user/login' to the actual class/function which is 'auth/login'

now the hard bit is that the first segment will always be the language identifier (es or en at the moment)... Here is my routes.php
Code:
$route['default_controller'] = "welcome";
$route['scaffolding_trigger'] = "";


// URI like '/en/about' -> use controller 'about'
$route['^es/(.+)$'] = "$1";
$route['^en/(.+)$'] = "$1";

// '/en' and '/fr' URIs -> use default controller
$route['^es$'] = $route['default_controller'];
$route['^en$'] = $route['default_controller'];

// The user routes (translate /user into /auth
$route['([a-z]+)/user/login'] = "$1/auth/login";

And it is not working... I assuming that the first routes are over riding the last one (which is the one i am trying to get to work) However I have tried putting the last one before the rest an it still doesnt work so i'm guessing its my syntax??

Help Appreciated! Sorry about my regex lack of knowledge!

Cheers, Dan
#2

[eluser]joytopia[/eluser]
Hi september28

I remember, that I had this problem too, and no it works with something like this:

Code:
$route['en/login'] = "auth/login";
$route['en/auth'] = "auth/login";
$route['en/auth/login'] = "auth/login";
$route['en/logout'] = "auth/logout";

regards, Bernd
#3

[eluser]Mauricio de Abreu Antunes[/eluser]
I have the same question.
I don't know how to route when i have several languages in my pages.
#4

[eluser]Mirge[/eluser]
2009, 2010...... poor 2011 was skipped.
#5

[eluser]Mauricio de Abreu Antunes[/eluser]
Hahaha
So, i solved the problem by myself. Smile




Theme © iAndrew 2016 - Forum software by © MyBB