diff --git a/app/Config/App.php b/app/Config/App.php
index 3385f355..3074c840 100644
--- a/app/Config/App.php
+++ b/app/Config/App.php
@@ -16,7 +16,7 @@ class App extends BaseConfig
      *
      *    http://example.com/
      */
-    public $baseURL = BASEURL . '/engineN';
+    public $baseURL = BASE . '/engineN';
 
     /**
      * Allowed Hostnames in the Site URL other than the hostname in the baseURL.
diff --git a/app/Config/Constants.php b/app/Config/Constants.php
index 3cb053a5..8282fcb1 100644
--- a/app/Config/Constants.php
+++ b/app/Config/Constants.php
@@ -78,8 +78,14 @@ defined('EXIT_DATABASE')       || define('EXIT_DATABASE', 8);       // database
 defined('EXIT__AUTO_MIN')      || define('EXIT__AUTO_MIN', 9);      // lowest automatically-assigned error code
 defined('EXIT__AUTO_MAX')      || define('EXIT__AUTO_MAX', 125);    // highest automatically-assigned error code
 
-$protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https://'.$_SERVER['HTTP_HOST'] : 'http://'.$_SERVER['HTTP_HOST'];
-    defined('BASEURL') || define('BASEURL',$protocol);
+$base = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "https");
+$base .= "://" . $_SERVER['HTTP_HOST'];
+//$base .= str_replace(basename($_SERVER['SCRIPT_NAME']), "", $_SERVER['SCRIPT_NAME']);
+
+defined('BASE') || define('BASE', $base);
+
+//$protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https://'.$_SERVER['HTTP_HOST'] : 'http://'.$_SERVER['HTTP_HOST'];
+//    defined('BASEURL') || define('BASEURL',$protocol);
 
 /**
  * @deprecated Use \CodeIgniter\Events\Events::PRIORITY_LOW instead.