Dynamically set CodeIgniter Base URL
Posted Date:20-06-2017
In this post we will explain dynamically set codeigniter baseurl.
Step 1: navigate to application/config and open config.php file edit $config[‘base_url’] using following code.
$config['base_url'] = ((isset ( $_SERVER ['HTTPS'] ) && $_SERVER ['HTTPS'] == "on") ? "https" : "http"); $config['base_url'] .= "://" . $_SERVER ['HTTP_HOST']; $config['base_url'] .= str_replace ( basename ( $_SERVER ['SCRIPT_NAME'] ), "", $_SERVER ['SCRIPT_NAME'] );