thomashw Posted March 22, 2008 Share Posted March 22, 2008 Yesterday my site was working great with sessions, but now when I move pages the session gets erased. I have session_start(); at the top of every page. I also have a switch statement redirecting the header. Could this be the problem? Any ideas what could be causing this? Link to comment https://forums.phpfreaks.com/topic/97371-sessions/ Share on other sites More sharing options...
Orio Posted March 22, 2008 Share Posted March 22, 2008 Try using a different browser / computer. It may not be a php issue, but your browser. If that doesn't help, any changes were made to any configurations of php such as modifications of php.ini ? Orio. Link to comment https://forums.phpfreaks.com/topic/97371-sessions/#findComment-498244 Share on other sites More sharing options...
thomashw Posted March 22, 2008 Author Share Posted March 22, 2008 It is my browser... that's weird as it was working perfectly fine last night. Hmm... Link to comment https://forums.phpfreaks.com/topic/97371-sessions/#findComment-498246 Share on other sites More sharing options...
redarrow Posted March 22, 2008 Share Posted March 22, 2008 clear your cache firefox goto tools>>>clear privert data Link to comment https://forums.phpfreaks.com/topic/97371-sessions/#findComment-498248 Share on other sites More sharing options...
thomashw Posted March 22, 2008 Author Share Posted March 22, 2008 Didn't work. I looked in my cookies, and it's savings two sessions - one for www.website.com and one for just website.com. Would that be my problem? How could I fix it? Link to comment https://forums.phpfreaks.com/topic/97371-sessions/#findComment-498258 Share on other sites More sharing options...
thomashw Posted March 22, 2008 Author Share Posted March 22, 2008 Okay, I think that was my problem. One of my forms was submitting to www, while most of my site doesn't use www in it. Is there a way to use an 'if-statement' at the top to check what URL is being accessed and to redirect if www is being used? Link to comment https://forums.phpfreaks.com/topic/97371-sessions/#findComment-498262 Share on other sites More sharing options...
Orio Posted March 22, 2008 Share Posted March 22, 2008 You should do that in your .htaccess Something like this should work: Options +FollowSymlinks RewriteEngine on RewriteCond %{http_host} ^your-website\.com [nc] RewriteRule ^(.*)$ http://www.your-website.com/$1 [r,nc] Orio. Link to comment https://forums.phpfreaks.com/topic/97371-sessions/#findComment-498266 Share on other sites More sharing options...
thomashw Posted March 22, 2008 Author Share Posted March 22, 2008 That works great - thanks! Link to comment https://forums.phpfreaks.com/topic/97371-sessions/#findComment-498270 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.