PHP sessions getting unset -


i'm using session variable store login data. locally, works smooth, logs in nicely , doesn't log out inbetween pages.

but when put same files on server, reason logged out. i've found this post, , tried using following code prevent caching of dynamic pages:

header("cache-control: no-cache, must-revalidate");  header("expires: sat, 26 jul 1997 05:00:00 gmt"); // date in past 

though doesn't seem work. there other possible solutions problem?

edit: note session_start() on every page.

edit 2: did little further investigation , appears of links link www.mysite.com when on mysite.com. going new page makes $_session[] vars aren't set, , when returning previous page button can see $_session[] still set.

sessions use cookies, when change domains (www.site.com site.com) cookies aren't being transmitted.

set webserver have 1 canonical url, , redirect (for example, standardize on site.com, redirect www.site.com site.com).

this how handle redirects in apache:

serveralias www.site.com my.site.com site.net www.site.net sites.com www.sites.com site.com rewriteengine on rewritecond %{server_name} !=site.com rewriterule ^(.*) https://site.com/$1 [r=301] 

i prefer site.com on www.site.com, unless you're doing different on 2 of them making people type 4 characters seems worthless. (lame) understanding of seo you're better off picking 1 having duplicate content @ 2 urls (site.com/stuff , www.site.com/stuff)


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -