diff --git a/security/Member.php b/security/Member.php
index <HASH>..<HASH> 100644
--- a/security/Member.php
+++ b/security/Member.php
@@ -421,9 +421,12 @@ class Member extends DataObject implements TemplateGlobalProvider {
 		$this->extend('memberLoggedOut');
 
 		$this->RememberLoginToken = null;
-		Cookie::set('alc_enc', null);
+		Cookie::set('alc_enc', null); // // Clear the Remember Me cookie
 		Cookie::forceExpiry('alc_enc');
 
+		// Switch back to live in order to avoid infinite loops when redirecting to the login screen (if this login screen is versioned)
+		Session::clear('readingMode');
+
 		$this->write();
 		
 		// Audit logging hook
diff --git a/security/Security.php b/security/Security.php
index <HASH>..<HASH> 100644
--- a/security/Security.php
+++ b/security/Security.php
@@ -951,7 +951,7 @@ class Security extends Controller {
 	 */
 	public static function set_login_url($loginUrl) {
 	    self::$login_url = $loginUrl;
-	}
+}
 	/**
 	 * Get the URL of the log-in page.
 	 * Defaults to Security/login but can be re-set with {@link set_login_url()}
BUGFIX Avoid infinite redirection when logging out and when showing a custom login page after displaying the draft version of a page.