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, h
$config['base_url'] = (isset($_SERVER['HTTPS']) ? "https://" : "http://").$_SERVER['HTTP_HOST'];
this works for me with virtualhost setup.