user116032
user116032

Reputation: 321

Site access via www.example.com v. example.com is causing problems with sessions

I have a site at GoDaddy. You may access it using a www prefix or not. It works fine either way unless you happen to hit a link that uses/does not use the prefix. Then the session disappears. Is www.example.com supposed to be the same as example.com? If not, how do I require the use of one or the other?

Upvotes: 2

Views: 76

Answers (1)

Blazeag
Blazeag

Reputation: 480

Sessions are based on cookies, and cookies are bound to a specific domain. www.abc.com is a subdomain of abc.com (In some cases, you might not even be the owner of both).

I would force webserver to add a www prefix (with .htaccess if you are using Apache: Example here)

Upvotes: 2

Related Questions