session data depending on 'www.' in URL |
Hi
Retrieving session data doesn't work properly anymore with me since Firefox, Vs. 39.0 (not in Chrome or Safari). The problem: I set session data over the URL 'www.mydomain.ch/login'. If I want to retrieve those session data over the address 'mydomain.ch/mycontroller' (without www.) I got redirected to the login page (meaning: no session data found). This is annoying since some people use the website with 'www.' others without. By the way: I have rewriting url already established in .htaccess (however without effect) RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] Had anyone similar problems? How can I get around this? Should I make a sort of front-controller that redirects all 'domain.ch/controller' to 'www.domain.ch/controller'? Thanks Martin
The problem isn't with sessions but with cookies. The session id is stored inside a cookie. Cookie are by default linked to a single domain so they dont share data between domain.com and www.domain.com
Inside config.php you should set it like so (notice the dot before the domainname) 'cookie_domain' = Set to .your-domain.com for site-wide cookies (07-28-2015, 02:56 PM)Diederik Wrote: The problem isn't with sessions but with cookies. The session id is stored inside a cookie. Cookie are by default linked to a single domain so they dont share data between domain.com and www.domain.com This solved the problem. Great. Thank you. |
Welcome Guest, Not a member yet? Register Sign In |