Re: Domain Redirect - loses session variables
- From: "Chung Leong" <chernyshevsky@xxxxxxxxxxx>
- Date: 9 Oct 2005 10:40:11 -0700
Andy Hassall wrote:
> If you want this to work, you'd need a method of migrating the session data
> from one domain to the other through some shared data storage.
I think you might have misunderstood the situation described by the OP.
He said he had purchased a new domain name. Presumbly, the name points
to the same machine. Unless the web server is set up to have different
session save-path per virtual host, session data are shared by default.
In any event, I believe you can override the save-path with ini_set().
The problem here is that cookies--hence session ids--don't travel
across domains. So you need to manually sync the cookies of the two
domains. One way to do this is to do a round-trip redirection at the
very beginning. From domain_1, redirect to a page on domain_2 with the
session id passed on the URL. This page calls session_id($_GET['SID'])
and session_start(), then redirect back to the original page in
domain_1. Now both domains will use the same session id. A simpler way
is to use an invisible inner frame to initialize the cookie in
domain_2.
All this is very confusing of course. Unless there a real reason to use
multiple domain names it'd be easier to just redirect all requests to
one name, possibly with the help of Apache rewrite.
.
- Follow-Ups:
- Re: Domain Redirect - loses session variables
- From: Andy Hassall
- Re: Domain Redirect - loses session variables
- References:
- Domain Redirect - loses session variables
- From: Vic Spainhower
- Re: Domain Redirect - loses session variables
- From: Vic Spainhower
- Re: Domain Redirect - loses session variables
- From: Jerry Stuckle
- Re: Domain Redirect - loses session variables
- From: Vic Spainhower
- Re: Domain Redirect - loses session variables
- From: Andy Hassall
- Domain Redirect - loses session variables
- Prev by Date: phpmailer and Send ID
- Next by Date: Parsing XML Tags Help
- Previous by thread: Re: Domain Redirect - loses session variables
- Next by thread: Re: Domain Redirect - loses session variables
- Index(es):
Relevant Pages
|