Knowledge Base
All Categories How to's Force HTTPS/SSL

Force HTTPS/SSL

In order to force users to only use https:// you must change the .htaccess file like below:

RewriteEngine On

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTPHOST}%{REQUESTURI} [R,L]

RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUESTFILENAME} !-f
RewriteCond %{REQUESTFILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]

If you get a mixed content warning and the login page appears without the background and any styling then you need to change your base url. 
In your /application/config/config.php you might need to change the $config['baseurl']= ''; to $config['baseurl']= 'https://yourDomainName.com';

Was this article helpful?

Thanks for your feedback!