Accessing Server using different URLs
From Proxmox VE
I installed the fengoffice in a LAN with locally resolving domain: http://www.officelocal.com
I also had the internet router forwarding Port 6000 from the WAN side to the server's LAN Port 80. From the outside, I must access the fengoffice like: http://officelocal.noip.com:6000
The file in /config/config.php has a define like:
define('ROOT_URL', 'http://www.officelocal.com');
This is so, because I had done the installation from the LAN.
In this hard coded manner, it will be difficult to have alternate URL for accessing it from outside the LAN.
To overcome the problem, we need to replace the above ROOT_URL define with the following in the /var/www/fengoffice/config/config.php file:
// =============
function Get_Base_From_File($file, $boolTrailingSep) {
$find = DIRECTORY_SEPARATOR;
$after_find = substr(strrchr($file, $find), 1);
$strlen_str = strlen($after_find);
$result = substr($file, 0, -$strlen_str-($boolTrailingSep ? 0 : 1));
return $result;
}
$file = $_SERVER['SCRIPT_URI'];
$base = Get_Base_From_File($file, FALSE);
define('ROOT_URL', $base);
// =============
