Redirect http to https in Codeigniter
If free certificate is Let's Encrypt you can also extend certificate to www
subdomain. But from SEO point of view it is better to concentrate traffic to just one of those.For wanted redirection I think Gumbo's answer can be helpful. For more useful .htaccess
snippets check this page.