Luis Lopez
Luis Lopez

Reputation: 561

language in codeigniter doesn' t work as expected

I have a web site with two languages, it works in localhost perfect. but when I run it on a production enviroment and people try to change the language doesn't work, they need to press F5 key in the browser,so then the site reload in the language they choose. Any idea?? Thanks...

public function __construct()
    {
        parent::__construct();     
        $this->lang->load('navmenu', $this->session->userdata('language'));
        $this->lang->load('search', $this->session->userdata('language'));
        $this->lang->load('home', $this->session->userdata('language'));
    }

/.../
function ChangeLanguage ($lang)
    {
        $this->session->set_userdata('language', $lang);
        redirect(base_url());
    }

  anchor('lang/changelanguage/spanish','Español')  
   anchor('lang/changelanguage/english','English')

Upvotes: 3

Views: 479

Answers (1)

fedmich
fedmich

Reputation: 5381

to debug this in production server, you can temporary put

error_reporting(E_ALL);

and see what other errors are there that prevents the proper redirecting. You also should check the response headers being sent by your production server. Does it have "cache", does it need re-validate header, etc

Upvotes: 1

Related Questions