1. Get a SSL certificate and install it (most shared hosting provides provide one free)
2. Create a User Defined Tag
I called my https and put this code in it...
Code: Select all
// Check if accessed via SSL
if(empty($_SERVER['HTTPS']))
{
// If not, redirect
$newurl = 'https://'.$_SERVER['SERVER_NAME'].':8087'.$_SERVER['REQUEST_URI'];
header("location: $newurl");
exit();
}
3. Modify config.php to use HTTPS urls when necessary
If you dont do this step, you will get security warnings on all your https pages.
Add this BEFORE the $config['root_url'] variable is defined...
Code: Select all
if(empty($_SERVER['HTTPS'])) {
$protocol = 'http://';
$port = '';
} else {
$protocol = 'https://';
$port = ':8087';
}
Here is how i set mine
$config['root_url'] = $protocol.'www.mydomain.com'.$port;
$config['uploads_url'] = $protocol.'www.mydomain.com'.$port.'/uploads';
$config['image_uploads_url'] = $protocol.'www.mydomain.com'.$port.'/uploads/images';
Finally, the last step - in your templates, add your User Defined Tag( {https} ) on the pages you wish to be HTTPS.