The problem is that on the indexS page you have the rule set to go to the profile page. So it is not just rejecting the user on this indexS page but also on the profile page. Since the profile page is the last attempted page to be accessed before the user is redirected to the login page it is the page that the user will go to after a successful login.
Your indexS page should redirect the user to the login page, not the profile page. In the code you posted you can just replace the profile page with the login page.
I will go ahead and close the ticket, when a ticket is opened based on a thread it makes it very confusing to have responses posted in multiple locations. In the future please only respond to your thread if a ticket has not been opened, if a ticket for the thread has been opened please just respond to the ticket and not the thread.