tags:

views:

86

answers:

2

I am in the process of planning for a series of websites that will all point to the same server and share the same back end code, but have different domain names, different content, and look completely different. Here is my issue, say a user visits one website and adds something to the cart, then visits the other website. (which is actually the same server just different domain pointing to it) I do not want the SESSION variables to travel across.

I am thinking one possible solution is to keep track of what domain they are requesting, and if that changes destroy the session, but the disadvantage there is if they go back, they will have lost everything. Is there a way to keep them all live but prevent them from going across domains? I hope this makes sense.

Thanks!

+3  A: 

Sessions do not travel across domains.

Residuum
Really? even if its the same file, just different domain pointing to it? I did not know that, that makes my life way easier! Thanks.
John Isaacks
Yep, the stay on the same domain. Unless you are using sub domains in which case you can set the domain variable in the cookie as indicated in my answer.
Shadi Almosri