--- securepages.module
+++ (clipboard)
@@ -25,6 +25,11 @@
     return;
   }
 
+	// clear redirected flag if redirect has been left from another page
+	if (isset($_SESSION['securepages_redirect']) && $_SESSION['securepages_redirect'] != $path) {
+		unset($_SESSION['securepages_redirect']);
+	}
+
   /**
    * If this is a cached page we need to do the check here even though we
    * have no access to the menu.
@@ -172,8 +177,8 @@
  */
 function securepages_goto($secure) {
   global $base_root;
-  
-  $_SESSION['securepages_redirect'] = TRUE;
+
+  $_SESSION['securepages_redirect'] = isset($_GET['q']) ? $_GET['q'] : '';
   $path = !empty($_REQUEST['q']) ? $_REQUEST['q'] : '';
   $query = count($_GET) > 1 ? securepages_get_query($_GET) : NULL;
   $url = securepages_url($path, array('query' => $query, 'secure' => $secure));
