Session lost after redirect in php


My session was lost when i m redirect to another domain and came to my domain. how to fix this ?



after getting result from the , i could not access my session values it was lost.


session_write_close should be what you’re looking for.
Use session_write_close before redirecting.

i have used but no change it behave like same

Did you use the function before or after your header function as you add it after the header the session won’t be able to store itself.

i have to redirect different domain

from IANA — Example domains to [url=]

when return back to www.example .com , my session was lost and create new session id. how to resolve it.

Maybe this setting needs to be tweaked:

PHP: Runtime Configuration - Manual


can you tell which one is better for this ? i didnt do anything in firefox,but in other browser start session automatically ,previous session was lost

I’m sorry but I am not sure I understand your question.

If your session is lost when switching sub-domains, it’s possibly due to the configuration options I linked to above. If your trying to persist a session across root domains, you will need to pass along the session ID with the URI.


i want to send some data from to after that send data to

when result came back from my session data are lost and create new session id . how to keep my session when redirect to another domain.