The logout page you visit is influenced by a cookie called originURI. So, if you reset the originURI on the second login page, when the user logs out they should be sent there.
For example, see this default code in a Mendix index.html file:
<script> if (!document.cookie || !document.cookie.match(/(^|;)originURI=/gi)) document.cookie = "originURI=/login.html"; </script>
So within that second login page, if you use an HTML snippet widget, you could set the cookie to the deeplink URL, something like this:
document.cookie = "originURI=/link/mydeeplink;
Thank you it worked!
the cookie originURI was replaced after a successful login. So I put i condition to avoid that, also after a log out a wasn’t send to the url in my originURI. i Had to put an html snippet that check the value of the cookie and redirect to the correct login page if needed.