HI,
My project have multiple modules. I have one menu it contains all module tabs. Let us,
i login in one module is called 'XXX'. Next i am going to another module is
called 'YYY' by clicking menu. In this process session values are working in
'XXX' module. But in 'YYY' module session are losting if url alike
'http://WWW.myurl' but in 'http://myurl' session values are
working. How to solve this problem ? If u have any ideas please advice me.
Thank in advance,
Suman.
Sessions are losting in http://www but working in http://url
Moderator: General Moderators
Re: Sessions are losting in http://www but working in http://url
Keep the same domain name. When you make links don't include the http://yoursite.com part, just the /path/to/file.php.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: Sessions are losting in http://www but working in http://url
Sounds like your cookie is being set at www. the domain, which does not include the non www version.
You best solution is NOT to support both domain.com and http://www.domain.com, but to redirect http://www.domain.com to just domain.co, or vice -versa.
In a .htaccess file, something like this:
Also (without taking this too seriously
): http://no-www.org/
You best solution is NOT to support both domain.com and http://www.domain.com, but to redirect http://www.domain.com to just domain.co, or vice -versa.
In a .htaccess file, something like this:
Code: Select all
RewriteEngine On
RewriteMap lowercase int:tolower
RewriteCond %{HTTP_HOST} ^www\.(.+) [NC]
RewriteRule ^/(.*)$ http://${lowercase:%1}/$1 [R=301,L]
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
Re: Sessions are losting in http://www but working in http://url
Your session is being saved to a specific subdomain - you can make your session available to all subdomains (including the root domain) by setting the cookie to ".domain.com" (notice the preceding dot?)
There are several ways to accomplish this... read: http://www.jontodd.com/2006/08/10/php-s ... e-domains/ for a few different methods.
There are several ways to accomplish this... read: http://www.jontodd.com/2006/08/10/php-s ... e-domains/ for a few different methods.