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

Problems with the Windows version of XAMPP, questions, comments, and anything related.

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

Postby modified » 08. July 2008 18:21

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!
modified
 
Posts: 3
Joined: 08. July 2008 18:17

Postby Wiedmann » 08. July 2008 19:12

However, i noticed that the http:// version of my site

Is there a servername missing in your example URI?
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby modified » 08. July 2008 19:58

modified
 
Posts: 3
Joined: 08. July 2008 18:17

Postby Wiedmann » 08. July 2008 20:06

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)
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby modified » 08. July 2008 20:15

is there a way to have xampp treat both as the same?
modified
 
Posts: 3
Joined: 08. July 2008 18:17

Postby Wiedmann » 08. July 2008 20:35

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)
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby Web-Man » 04. October 2008 12:40

I have same error too
I can acess to http://mysite.com but when my users go to www.mysite.com doent' work :s
Web-Man
 
Posts: 2
Joined: 23. June 2008 11:37

Postby glitzi85 » 06. October 2008 10:21

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
User avatar
glitzi85
 
Posts: 1920
Joined: 05. March 2004 23:26
Location: Dahoim

Re:

Postby Yukan » 06. October 2008 22:08

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"
Yukan
 
Posts: 6
Joined: 29. March 2008 10:36

Postby glitzi85 » 07. October 2008 02:20

@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
User avatar
glitzi85
 
Posts: 1920
Joined: 05. March 2004 23:26
Location: Dahoim


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 75 guests