From 813d9835440f5a495081401c4f3c8adc5ea91efb Mon Sep 17 00:00:00 2001
From: = <=>
Date: Mon, 7 Oct 2024 14:17:44 +0700
Subject: [PATCH] base url change

---
 .htaccess                |  2 +-
 app/Config/App.php       |  2 +-
 app/Config/Constants.php | 10 ++++++++--
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/.htaccess b/.htaccess
index b2345f1e..dbed322f 100644
--- a/.htaccess
+++ b/.htaccess
@@ -24,7 +24,7 @@ Options -Indexes
 	# Rewrite "www.example.com -> example.com"
 	RewriteCond %{HTTPS} !=on
 	RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
-	RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L]
+	RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
 
 	# Checks to see if the user is attempting to access a valid file,
 	# such as an image or css document, if this isn't true it sends the
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.