Reputation: 103507
when I create a cookie for a domain, is it possible for me to set that this domain should be on both the www and non www domain?
I check for a cookie, and if not present I rediret to login page (its not a super secure thing). it seems when the user has a cookie, if the url changes to www. it gets redirected to login again.
Upvotes: 4
Views: 329
Reputation: 180024
@electronherders' solution works, but you should also consider canonicalising either the www or the no-www domain. Redirect visitors from one to the other, so there's only one correct URL for your site.
Upvotes: 2
Reputation: 2049
When you drop the cookie specify .mydomain.com - note the leading period. That should work for both the root domain and the www subdomain.
Upvotes: 5