Answer the question
In order to leave comments, you need to log in
How to transfer a session to a subdomain?
On example.com/session.php a session is created and data is pushed in, $_SESSION['name'] = 'MyName';
And now you need to transfer this MyName to a specific subdomain, exactly to 1 subdomain, for example, subdomain.example.com
+ to example.com/session.php after stuffing the data, redirect to subdomain.example.com/somepage using header('Location: subdomain.example.com/somepage ');
//End of question
Answer the question
In order to leave comments, you need to log in
In .htaccess:
php_value session.cookie_domain ".site.com"
Or using PHP
session_set_cookie_params(7200, "/", ".site.com", false, false);
session_start();
Or manually pass
header('Location: subdomain.example.com/somepage?PHPSESSION=my_session');
And on a subdomain to process
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question