diff --git a/includes/main/WebUI.php b/includes/main/WebUI.php
index 6393ec94cc91ad4a9f9eab8ca9bcfe2cf6cdfd8a..4b6dde122434ad9f799d4db709265008a1e97c89 100644
--- a/includes/main/WebUI.php
+++ b/includes/main/WebUI.php
@@ -103,12 +103,13 @@ class Vtiger_WebUI extends Vtiger_EntryPoint {
 		// common utils api called, depend on this variable right now
 		$currentUser = $this->getLogin();
 		vglobal('current_user', $currentUser);
-                //check we are being connected to on the right host and protocol
-                global $site_URL;
-                if ((stripos($site_URL,$_SERVER['REQUEST_SCHEME']."://".$_SERVER['HTTP_HOST']) !== 0)){
-                    header("Location: $site_URL",TRUE,301);
-                    die();
-                }
+		
+		// Check we are being connected to on the right host and protocol
+        global $site_URL;
+        if ($site_URL && (stripos($site_URL,$_SERVER['REQUEST_SCHEME']."://".$_SERVER['HTTP_HOST']) !== 0)){
+            header("Location: $site_URL",TRUE,301);
+            exit;
+        }
 
 		global $default_language;
 		vglobal('default_language', $default_language);