Are you tired of changing script path each time you more your script into different locations. Here is a trick, so that you can automatically get base_url
without changing each time you move your code.
Change $config['base_url']
into this syntax.
defined('BASE_URL') OR define('BASE_URL', (is_https() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']) . '/');
$config['base_url'] = BASE_URL;
Here is another tutorial to remove index.php from Codeigniter URL.
If you liked this article, then please subscribe to our YouTube Channel for useful videos. You can also find us on Twitter and Facebook.
Write a Reply or Comment