Welcome Guest, Not a member yet? Register   Sign In
Problem with langs in URL when moving to server (internationalization i18n)
#1

[eluser]term25[/eluser]
Hi, I have problem with i18n.

On localhost everything works great, but after moving to my server (justhost provider) I get these 2 errors:

Quote:A PHP Error was encountered

Severity: Notice

Message: Uninitialized string offset: 0

Filename: core/MY_Lang.php

Line Number: 72

Quote:A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /home/****/public_html/*****/*****/*****/system/core/Exceptions.php:170)

Filename: core/MY_Lang.php

Line Number: 75

So, I looked at the line 72 in the core/MY_Lang.php and there is this line:

Code:
$uri = ($uri[0] != '/') ? '/'.$uri : $uri;

It is in the part which set default lang in url I guess:

Code:
if ((!$url_ok) && (!$this->is_special($uri_segment['parts'][0]))) // special URI -> no redirect
     {
      // set default language
      $CFG->set_item('language', $this->languages[$this->default_lang()]);
      
      $uri = (!empty($this->uri)) ? $this->uri: $this->default_uri;
          $uri = ($uri[0] != '/') ? '/'.$uri : $uri;
      $new_url = $CFG->config['base_url'].$this->default_lang().$uri;
      
      header("Location: " . $new_url, TRUE, 302);
      exit;
     }

This error occurs only when I access my site like:

http://www.example.com/temp/site/

when I type it like this:

http://www.example.com/temp/site/en

or

http://www.example.com/temp/site/fr

everything works great

How to solve it?

Thanks in advance.





Theme © iAndrew 2016 - Forum software by © MyBB