Hi all,
There's something quite annoying about sessions - that is, I think the sessions are different for http://example.com and http://www.example.com.
If sessions are set in one, it is not set in the other.
This can get very annoying. Is there a way around this?
sessions are different if url has www. in front
Moderator: General Moderators
-
tehhparadox
- Forum Newbie
- Posts: 18
- Joined: Thu Oct 01, 2009 11:55 am
- Tiancris
- Forum Commoner
- Posts: 39
- Joined: Sun Jan 08, 2012 9:54 pm
- Location: Mar del Plata, Argentina
Re: sessions are different if url has www. in front
Yep, you're right. Same thing happened to me and I've solved adding a redirect from http://domain to http://www.domain.
This way you ensure that the site is navigated always in the same url.
I made this redirections using cPanel, and the result is something like this (htaccess file):
[text]RewriteCond %{HTTP_HOST} ^blablabla.com.ar$
RewriteRule ^(.*)$ "http\:\/\/www\.blablabla\.com\.ar\/$1" [R=301,L][/text]
And works in all this cases:
[text]http://blablabla.com.ar =====> http://www.blablabla.com.ar
http://blablabla.com.ar/item.php =====> http://www.blablabla.com.ar/item.php
http://blablabla.com.ar/item.php?id=15 =====> http://www.blablabla.com.ar/item.php?id=15[/text]
This way you ensure that the site is navigated always in the same url.
I made this redirections using cPanel, and the result is something like this (htaccess file):
[text]RewriteCond %{HTTP_HOST} ^blablabla.com.ar$
RewriteRule ^(.*)$ "http\:\/\/www\.blablabla\.com\.ar\/$1" [R=301,L][/text]
And works in all this cases:
[text]http://blablabla.com.ar =====> http://www.blablabla.com.ar
http://blablabla.com.ar/item.php =====> http://www.blablabla.com.ar/item.php
http://blablabla.com.ar/item.php?id=15 =====> http://www.blablabla.com.ar/item.php?id=15[/text]