.htaccess detect "/logged-in" at end of any URL and redirect to same URL

I'd like to know how to create a .htaccess rewrite rule that can check for "/logged-in" at the end of any pretty URL, and then pass a GET parameter back to that same page.

Essentially the user can log in on any page, then the page reloads with /logged-in attached to it. I need to run some PHP that checks:

if ($_GET['mode'] == 'logged-in') 

to display a modal on the page they were on confirming the login.

It can be any page on the site, any level deep.

So an example URL might be:


which would need to rewrite to:


Obviously the above URL is already being rewritten prior to this as it is actually loading:


So essentially need to know how to detect:


and get back to


while keeping the URL pretty.