Randomly Losing Session Variables Only In Google Chrome & URL Rewriting
I had the same issue, and to fix it I only had to create a favicon.ico and place it in the webroot - otherwise I could see using Fiddler that a 404 resulted for this with every page request from Chrome (despite me not actually linking to a favicon in the page markup).
In my mind this is clearly a bug in Chrome, as the lack of a favicon should have no bearing on session data.
Turns out the issue was with the contents of my .htaccess file. This resolved the issue:
#<IfModule mod_rewrite.c>############################################## enable rewrites Options +FollowSymlinks RewriteEngine on############################################## always send 404 on missing files in these folders RewriteCond %{REQUEST_URI} !^/.*(themes|wysiwyg|images|js)/############################################## always send 404 on missing favicon RewriteRule ^favicon.ico$ favicon.ico [L]############################################## never rewrite for existing files, directories and links RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l############################################## rewrite everything else to index.php RewriteRule .* index.php#</IfModule>
Try using;
session_set_cookie_params(0, '/', '.domain.com');
to enforce the session cookie params. Remove the prefixed period if you are enforcing 'no www', or aren't using subdomains.
You can also try calling session_write_close()
at the end of the script to force PHP to write and close the session then and there (this is especially handy when you run redirect headers right after writing session data).
UPDATE:
Try using this in your .htaccess
;
RewriteBase /RewriteRule ^index\.php$ - [L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]