Membuat base_url dinamis pada codeigniter


Buka file config.php pada folder aplication/config
cari tulisan :

$config['base_url'] =' ';

rubah menjadi :

$http = 'http' . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 's' : '') . '://';
$newurl = str_replace('index.php','', $_SERVER['SCRIPT_NAME']);
$config['base_url']    = "$http" . $_SERVER['SERVER_NAME'] . "" . $newurl;

Subscribe to receive free email updates: