Page 1 of 1

http:// and http://www. treated differently

PostPosted: 08. July 2008 18:21
by modified
Hey guys, I've been using xampp for a while and i've started creating a site with sessions. However, i noticed that the http:// version of my site and the http://www. version did not contain the same session info.

is there some kind of setting i need to enable or change?

Thanks in advance!

PostPosted: 08. July 2008 19:12
by Wiedmann
However, i noticed that the http:// version of my site

Is there a servername missing in your example URI?

PostPosted: 08. July 2008 19:58
by modified

PostPosted: 08. July 2008 20:06
by Wiedmann
Well, "www.mysitename.co" is a different hostname then "mysitename.com".

Thus, a session you have started on one host(name), is not a same then a session on another host(name).

(sorry, can't say more. because not enough infos about a specific problem with examples/code)

PostPosted: 08. July 2008 20:15
by modified
is there a way to have xampp treat both as the same?

PostPosted: 08. July 2008 20:35
by Wiedmann
is there a way to have xampp treat both as the same?

It's more a problem how you handle the session id:
- if you append the SID to the URIs there is no problem.
- if you are using cookies, a cookie which is set at "example.com", is also valid for "foo.example.com", but not vis versa.
(--> Maybe "session.cookie_domain" can help you)

PostPosted: 04. October 2008 12:40
by Web-Man
I have same error too
I can acess to http://mysite.com but when my users go to www.mysite.com doent' work :s

PostPosted: 06. October 2008 10:21
by glitzi85
Web-Man wrote:I have same error too
I can acess to http://mysite.com but when my users go to www.mysite.com doent' work :s

What do you mean with error? and What do you mean with go?

Did you inform yourself about cookies? If you are using cookies for storing the Session-ID than you should not switch between different URLs (example.com and www.example.com ARE different URLs)

glitzi

Re:

PostPosted: 06. October 2008 22:08
by Yukan
Well, with every website I've created, setting the cookie's domain to
.mydomainname.tld worked even if the third level domain changed.

Example:

User browses www.mydomain.com. A session cookie is created.
User then clicks a link that directs them to mydomain.com. The cookie session is still active. They then click on another link that directs them to
forum.mydomain.com, the cookie session still works.

It works because the cookie domain is ".mydomain.com" instead of "www.mydomain.com"

PostPosted: 07. October 2008 02:20
by glitzi85
@Yukan: Do you have any experience which browsers need this special treatment? I normally do not work with Cookies, so i am not very experienced in this stuff.

glitzi