this is the code I use to turn https on and off with an extra check to see if I am working on my local development server
Turn HTTPS off
<?php
if ($_SERVER['HTTP_HOST'] != 'site.local') // insert local hostname here
{
if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on')
{
header("Location: http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']);
}
}
?>
Turn HTTPS on
<?php
if ($_SERVER['HTTP_HOST'] != 'site.local') // insert local hostname here
{
if (!isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'on')
{
header("Location: https://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']);
}
}
?>
Hope that helps