Session variables disappear for some users (drupal

2019-05-28 14:34发布

I have this problem in my site that haunts me for months. I keep getting around it, but now I seem not to be able to find such a way, so I figured why not tackle the root problem?

My root problem is that sometimes (not always) session data disappears for some of my users. I know most of them for sure have cookies enabled. I thought maybe it's a session expiry thing, but I don't think that's it. I set the expiration for very long, plus the amount of users that their session gets erased is just too damn high...

I'm using drupal 6.

Any suggestions?

7条回答
趁早两清
2楼-- · 2019-05-28 14:54

I had a similar problem once, the reason being the famous www.

The site was enabled to be accessed through both www.example.com and example.com, which worked fine until the user hit a link which was hardcoded with the oposit domainname. Then he switched domain/subdomain and apache/php created a new session for the user on the "new" domain. It was in particular annoying when people were returning from payment.

Solution in our case was to always force users to use only example.com and either disable or redirect all requests to www.example.com directly to example.com. This way you never get sessions on both.

查看更多
登录 后发表回答