diff --git a/interface/lib/classes/auth.inc.php b/interface/lib/classes/auth.inc.php
index ef9b4fc63cec0711116487d963eb4af39f54146e..3bd5f5cb76098674b96c6403aab46229d5001120 100644
--- a/interface/lib/classes/auth.inc.php
+++ b/interface/lib/classes/auth.inc.php
@@ -94,7 +94,8 @@ class auth {
 	public function check_module_permissions($module) {
 		// Check if the current user has the permissions to access this module
 		if(!stristr($_SESSION["s"]["user"]["modules"],$module)) {
-			header("Location: ../index.php");
+			echo "LOGIN_REDIRECT:/index.php";
+			//header("Location: ../index.php");
 			exit;
 		}
 	}
diff --git a/interface/web/js/scrigo.js b/interface/web/js/scrigo.js
index df43d2f876c524b01764fdccd5b83e61964c90bb..3fde0664897563d67dc2adbed6191ac56ccbf7fc 100644
--- a/interface/web/js/scrigo.js
+++ b/interface/web/js/scrigo.js
@@ -46,6 +46,9 @@ function submitLoginForm(formname) {
 				loadContent(parts[1]);
 				//redirect = parts[1];
 				//window.setTimeout('loadContent(redirect)', 1000);
+			} else if (o.responseText.indexOf('LOGIN_REDIRECT:') > -1) {
+				// Go to the login page
+				document.location.href = 'index.php';
 			} else {
 				document.getElementById('pageContent').innerHTML = o.responseText;
 			}