1) Godaddy does offer a refund if you cancel. This is your smartest move, but I understand that it might be somebody elses website you are working on.
2) I normally force HTTPS inside a controller. It would be a rare situation that you would want to force HTTPS for an entire site, but in that case, you could just extend the Controller class with a MY_Controller class. Then you would create a constructor that checks if HTTPS is on, and if not redirect to the equivalent HTTPS page. For an example of forcing HTTPS inside an individual controller:
public function __construct()
{
parent::__construct();
// force SSL is available
// USE_SSL is defined in a hook - 1 is on and 0 is off
if(USE_SSL != 0 && !isset($_SERVER['HTTPS']))
{
$this->load->helper('string');
// secure_base_url() and url_suffix() come from an extension of the url helper.
header("Location: " . secure_base_url() . trim_slashes( $this->uri->uri_string() ) . url_suffix(), TRUE, 301);
exit;
}
}
MY_url_helper.php:
<?php
/*
* Since trying to access a secure URL can result in errors,
* this function only creates a secure URL if the my_site_definitions_hook
* has the setting for USE_SSL set to 1.
*/
function secure_base_url()
{
$CI = get_instance();
$url = $CI->config->slash_item('base_url');
if(USE_SSL === 1)
{
$url = substr($url, 0, 4).'s'.substr($url, 4);
}
return $url;
}
/*
* This function checks if SSL is on for the current request,
* and if it is, it makes a secure URL. This can be used to
* load resources like stylesheets, images, or javascript
* in a way that won't cause a partially secure warning in the browser.
*/
function if_secure_base_url()
{
$CI = get_instance();
$url = $CI->config->slash_item('base_url');
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on')
{
$url = substr($url, 0, 4).'s'.substr($url, 4);
}
return $url;
}
/*
* This current_url function has been overridden because
* the CI version doesn't allow for secure URLs.
*/
function current_url()
{
$CI = get_instance();
$url = $CI->config->site_url($CI->uri->uri_string());
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on')
{
$url = substr($url, 0, 4).'s'.substr($url, 4);
}
return $url;
}
/*
* This function allows for a more convenient way to
* create dynamic URLs that will have the appropriate
* URL suffix, as specified in the main config file.
*/
function url_suffix()
{
$CI = get_instance();
return $CI->config->item('url_suffix');
}
/* End of file MY_url_helper.php */
/* Location: /application/helpers/MY_url_helper.php */