$protocol = stripos($_SERVER['SERVER_PROTOCOL'],'https') === true ? 'https://' : 'http://';
$root = $protocol.$_SERVER['HTTP_HOST'];
$root .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
$config['base_url'] = "$root";
Note: Use this code in application/config/config.php
Search Knowledge Base Articles
Dynamic Base URL for Codeigniter Projects
Did you find this article useful?
Related Articles
-
Wordpress - Accordion CSS & JS
//CSS.accordion {background-color: #eee;color: #444;cursor: pointer;padding: 18px;width: 100%;border... -
How to Stop Chrome from Automatically Redirecting to https
https://howchoo.com/chrome/stop-chrome-from-automatically-redirecting-https... -
STOP LOADING A WEBPAGE IF JAVASCRIPT DISABLED
STOP LOADING A WEBPAGE IF JAVASCRIPT DISABLED All the webpages, works with supporting files such as ... -
SMS API
$authkey = 'key';$sender_id = 'senderid';$DLT_TE_ID = dltid;$country_code = '0';$message_content = '... -
Youtube Thumbnail image
Youtube video thumbnails are available in four different qualities and dimensions.SD 640 x 480https:...