Question : how to set base url in codeigniter
Answered by : yawning-yacare-wy3cep27exjh
$base_url = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
$base_url .= "://". @$_SERVER['HTTP_HOST'];
$base_url .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
$config['base_url'] = $base_url;
Source : https://stackoverflow.com/questions/11792268/how-to-set-proper-codeigniter-base-url | Last Update : Mon, 02 Aug 21
Question : dynamic base url codeigniter
Answered by : confused-chipmunk-nyedd7qqp54w
defined('BASE_URL') OR define('BASE_URL', (is_https() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']) . '/');
$config['base_url'] = BASE_URL;
Source : | Last Update : Wed, 09 Dec 20
Question : codeigniter base_url
Answered by : wrong-wolverine-z0nov1pr3sik
$this->load->helper('url');
Source : https://stackoverflow.com/questions/6449386/base-url-function-not-working-in-codeigniter | Last Update : Fri, 13 Mar 20
Question : fix working base_url for local and server both in codeigniter
Answered by : ankur-prajapati
$config['base_url'] = "http://".$_SERVER['SERVER_NAME']."/project_name/";
this way you config you base_url , then won't worry about in hosting. both works in localhost and server.
Source : | Last Update : Wed, 17 Jun 20
Question : codeigniter base url automatic
Answered by : harendra
$base_url = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
$base_url .= "://". @$_SERVER['HTTP_HOST'];
$base_url .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
$config['base_url'] = $base_url;
Source : https://hackeradda.com/read/how-to-set-dynamic-base-url-in-codeigniter | Last Update : Tue, 23 Feb 21