Your issue may be with cookie sharing.
Let's start with the fact that% of% of% with% of its% is% of% and% of% is URL
. Okay?
When setting a cookie, it is being set to produção
ie it will be persistent in either prod.url.com
or homologação
which are homo.url.com
of .url.com
. Followed?
PHP gives you the ability to set the domain cookie:
setcookie('YourCookieName', 'Some Values', time() + 3600, '/', 'url.com');
This way the cookie will only be set to prod.url.com
setcookie('YourCookieName', 'Some Values', time() + 3600, '/', '.url.com');
This way the cookie will be set to homo.url.com
and sub-domains.
To set a cookie for a specific subdomain, which is what you need, just do:
setcookie('YourCookieName', 'Some Values', time() + 3600, '/', 'homo.url.com');
In this way, when accessing sub-dominios
you will be logged in, accessing url.com
you will need to log in again.
Well, it's the most that I can analyze you, because you did not post code, so I believe that's what is happening.
Edit
If you are not working with sub domains, that is, with paths p.x: url.com
or url.com
ai is another question, since for the server they are the same system.
I have a global solution for this type, because I avoid working with separate systems separated by paths, I always try to work with sub-domains, the integrity is greater.
If you work this way the best way is to login to define which system the user is logging in. For example saving to his session
$_SESSION['ambiente'] = 1 // url.com/prod
When checking if the user's login is active you ask him what his environment is, what% s% s he is visiting? If it is not you force logout to renew your login to that environment.
For further explanation just by looking at the code, it's as much as I can.
Hugs.