I am facing a problem that is to get the domain name from my site. I tried the code:
define('PROTOCOL', 'http://');
define('DOMAIN', (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ''));
define('SUB_FOLDER', str_replace('public', '', dirname((isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : ''))));
define('BASE_URL', PROTOCOL . DOMAIN . ((substr(SUB_FOLDER, -1, 1) == '/') ? substr(SUB_FOLDER, 0, strlen(SUB_FOLDER)-1) : SUB_FOLDER));
The problem is that HTTP_HOST returns me the ip of the server and not the domain: web.mysite.com
Note: My site is on cluster servers. it has a total of 10 servers 5 in Brazil and 5 in the United States.