1

Suppose I want my site to be accessible at https://www.example.com and https://example.com.

Is it possible to set a cookie when visiting one domain so that it is accessible in the other?

1 Answer 1

4

Yes you can, try setting the cookie for .example.com as domain. That way, the cookie will be valid for every subdomain of yours.

For example, PHP sessions would be like this: session_set_cookie_params(0, '/', '.example.com');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.