I try the use a dynamic base url in this post:
Set Dynamic Base Url in CodeIgniter
But I used to be use the http, but now, I would like to change to https, how can I do so? Thanks.
In your config/config.php, try this:
$root=(isset($_SERVER['HTTPS']) ? "https://" : "http://").$_SERVER['HTTP_HOST'];
$root.= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
$config['base_url'] = $root;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With