Re: sessions vs domain problem
| From: | Colin Guthrie | Date: | Fri, 22 Dec 2006 14:32:25 +0000 |
| Subject: | Re: sessions vs domain problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-246151@lists.php.net to get a copy of this message | ||
Reinhart Viane wrote:
> I have the folowing problem :
>
> Hosting of my site is at http://www.groep6049.ksjnet.be
> <http://www.groep6049.ksjnet.be/>
>
> My domainname is www.ksachiropoelkapelle.be
> <http://www.ksachiropoelkapelle.be/>
>
>
>
> I have forwarded www.ksachiropoelkapelle.be
> <http://www.ksachiropoelkapelle.be/> towards
> http://www.groep6049.ksjnet.be/index.php
I think this is because the browser thinks it is working with the domain
name www.ksachiropoelkapelle.be and the server thinks it is working with
the domain name www.groep6049.ksjnet.be.
I also assume that the forwarding is based on Apache mod_rewrite rather
than a simple frame.
If you don't ever really want to access the "uglier" domain directly
(e.g. you are doing this to get free/cheap hosting) then you should be
able to tell PHP to use the correct domain for cookie paths using:
http://uk2.php.net/manual/en/function.session-set-cookie-params.php
Something like:
<?php
session_set_cookie_params(0, '/', 'ksachiropoelkapelle.be');
session_start();
...
Hope that works for you.
Col.