Codeigniter Session Lost or Late when in Live Server but not in Localhost

for some shared hosting provider espicially based on os litespeed make Codeigniter session lost or late after redirecting function.

example case we set session $this->db->set_userdata('car', 'Honda'). On first response Codeigniter will succeed save session with value Honda, but if we set again with new value like $this->db->set_userdata('car', 'Ducati') session value still ‘Honda’ except we give space for a few second.

the solution is add on your .htaccess with this code

<IfModule LiteSpeed>
CacheDisable public /
CacheDisable private /
</IfModule>

then refresh your site. good luck and don’t forget to drink your coffee

Leave a Reply

Your email address will not be published. Required fields are marked *