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

[eluser]mathg[/eluser]
Hello I'm using URI language identifier to parse my URL and get the language of my site.

The problem is that CI doesn't find any URI with this line of code.
Code:
$lang_abbr = current($RTR->uri->segments);

If I var dump that line I get bool(false). If I remove the "current()" and just var_dump the rest I get this : array(0);

The current URL in the browser is www.mysite.com/fr but it acts like there is not "fr" in the url.

Here are my settings. Is there a problem with my routing or anything else? Thank you.

.htaccess
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|public|gestion|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]

routes.php
Code:
$route['default_controller'] = "main";
$route['scaffolding_trigger'] = "";

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

By the way The 2 last lines are from the URI language wiki, I copied them there because that's what it says to do, but I don't understand thoses 2 lines. Could anyone explain them to me please?

Thanks
#2

[eluser]mathg[/eluser]
Ok it seems that the problem is with my routing.

If I deactivate the rewrite engine in the htaccess and use an url like www.mysite.com/index.php/fr the library is able to get the lang abbr in the URI.

Which means there is something wrong probably with the routing rules. I think the rules are made to be working with the index.php in the url.

Does anyone know how to make it work without the index.php in the url?




Theme © iAndrew 2016 - Forum software by © MyBB