1. Home
  2. tinyCampaign
  3. Secure Socket Layer (SSL)

Secure Socket Layer (SSL)

In order to enable tinyCampaign¬†over a Secure Socket Layer (SSL),¬†you will need to add some code to your custom dropin file. If you don’t have a custom dropin, create a new file and name it custom.dropin.php, and drop it into your dropins folder. Open the new file and add the following code to it.

<?php
if (!defined('BASE_PATH'))
    exit('No direct script access allowed');

$app = \Liten\Liten::getInstance();

function enable_force_url_ssl()
{
    $app = \Liten\Liten::getInstance();
    $domain = str_replace('http://', '', url('/'));
    $url = 'https://' . $domain;

    if ($app->req->server['SERVER_PORT'] != 443) {
        $https = rtrim($url, '/');
        redirect($https . $app->req->server['REQUEST_URI']);
        exit();
    }
    return $url;
}
$app->hook->{'add_filter'}('base_url', 'enable_force_url_ssl');

And that’s it. Once you save the changes, load your site into a browser and the system will automatically be served over SSL.

Updated on February 9, 2017

Was this article helpful?

Related Articles