Magento cookie settings for subdomain

Mohaimen picture Mohaimen · Jul 26, 2015 · Viewed 7.1k times · Source

When I am installing Magento under a subdomain of my production domain, I cannot login to magento admin. For example, my domain name is example.com where I have installed magento and it is in production, I am ok with admin login.

However, I have a subdomain called test.example.com and I installed magento there for testing purpose. Now, if I try to login to the test site, I can't login. The username and passwords are correct. I see no error message. It just reloads the same login page. Same things happens when I try to login to my production site admin panel.

If I clear the cookies related to example.com and test.example.com and then try to login to the admin panel of example.com, I am fine. Now, when I try to login to test.example.com admin panel, the problem starts again.

This is what my Session Cookie management settings

Is there anybody who can help me solving this issue?

Answer

Michael Stork picture Michael Stork · Jul 26, 2015

Your live system's cookie are set for .example.com, which means for your live system's domain and also all subdomains. Because test.example.com is a subdomain, both cookies are valid for it.

Try the following settings, then Magento will set cookies for .www.example.com and .test.example.com and your live domain's cookies will not interfere with your subdomain's.

live domain

subdomain