sessions lost if 'www' removed from URL - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: sessions lost if 'www' removed from URL (/showthread.php?tid=18995) |
sessions lost if 'www' removed from URL - El Forum - 05-24-2009 [eluser]smick[/eluser] Hello, I just discovered that if I change the url of my website from http://www.mysite.com to http://mysite.com that none of my session data is retained? How can I fix this error? Thanks for any info. sessions lost if 'www' removed from URL - El Forum - 05-25-2009 [eluser]Dam1an[/eluser] This is because www.site.com and site.com are considered to be 2 differant websites To get around this, you can use .htaccess to always force the same version (always with or without the www) I can't remember what it is off the top of my head, so you'l have the search for it sessions lost if 'www' removed from URL - El Forum - 05-25-2009 [eluser]eoinmcg[/eluser] Adding this to the end of your .htaccess should do the job Code: RewriteCond %{HTTP_HOST} !^www.yourdomain\.com [NC] Of course, if you have Code: [L] |