Search code examples
phpcodeigniteruripathinfo

Codeigniter uri_string not returning the full path


So being locate at this url (as an example) : http://localhost/codeigniter-app/en/results?search_query=data

uri_string doesn't return the needed path

["uri_string"]=>
  string(10) "en/results"

and the expected:

["uri_string"]=>
  string(10) "en/results?search_query=data"

Some of my config.php

$config['uri_protocol'] = 'AUTO';
$config['url_suffix'] = '';
$config['allow_get_array']      = TRUE;
$config['enable_query_strings'] = false;

Any ideas?

Edit:

The problem is found when using http://codeigniter.com/wiki/CodeIgniter_2.1_internationalization_i18n library


Solution

  • I ended adding this in application/core/MY_Lang.php where I needed to get the correct path:

    if(preg_match('/results/', $this->uri))
    {
        $this->uri = $this->uri.'?'.$_SERVER['QUERY_STRING'];
    }
    

    bellow: $this->uri = $URI->uri_string();