J
J
JIenpukoH2015-01-18 22:55:33
PHP
JIenpukoH, 2015-01-18 22:55:33

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

1 answer(s)
D
developinwed, 2015-01-18
@developinwed

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 question

Ask a Question

731 491 924 answers to any question