Site breaks when installing SSL certificate

ClassiBase classifieds script Forums General help Site breaks when installing SSL certificate

This topic contains 4 replies, has 2 voices, and was last updated by  ClassiBase 1 week, 5 days ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #3637 Reply

    Peter_Pan
    Participant

    Hello,

    I have configured my site and am ready to launch. However, I bought an SSL certificate and installed and when I add to the site, the site breaks. It appears the site is not designed to run https or the links when loading the page are not completing.The http site loads all content, but the https site has mos content blocked.

    Is there a fix to this? I hasten to add, am almost launching and so need a quick answer whether it’s possible or not.

    #3642 Reply

    ClassiBase
    Keymaster

    Hello,

    SSL is not supported by default, you have to make changes to code to make it work on https.

    ———
    1) Make chanegs to sys/config.php file on line 51 replace existing

    define('URL_PUBLIC', 'http://' . DOMAIN . '/');

    with this 2 lines

    define('PROTOCOL', (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://");
    define('URL_PUBLIC', PROTOCOL . DOMAIN . '/');

    Here we get protocol from $_SERVER variable and use it for urls.

    ———
    2) in /sys/app/models/AuthUser.php file, line 87 change from
    $rd = '?rd=' . urlencode('http://' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
    to
    $rd = '?rd=' . urlencode(PROTOCOL . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
    ———
    3) in sys/app/models/Ad.php file change line 1675 from
    return 'http://chart.apis.google.com/chart?chs=300x300&cht=qr&chld=L|2&chl=' . urlencode($info);
    to
    return '//chart.apis.google.com/chart?chs=300x300&cht=qr&chld=L|2&chl=' . urlencode($info);
    ———
    4) in sys/app/models/Captcha.php file on line 143 change
    $.getScript("http://www.google.com/recaptcha/api/js/recaptcha_ajax.js",function(){
    to
    $.getScript("//www.google.com/recaptcha/api/js/recaptcha_ajax.js",function(){

    on line 121 change
    $input = recaptcha_get_html($publickey) . Validation::getInstance()->{$name . '_error'};
    to

    $use_ssl = (PROTOCOL === 'https://' ? true : false);
    $input = recaptcha_get_html($publickey, null, $use_ssl) . Validation::getInstance()->{$name . '_error'};

    ———
    5) in /sys/app/models/Map.php on line 192 change
    var script_src = "http://maps.googleapis.com/maps/api/js?sensor=false&callback=gm_initialize";
    to
    var script_src = "//maps.googleapis.com/maps/api/js?sensor=false&callback=gm_initialize";

    and on line 299 change
    script.src = "http://maps.googleapis.com/maps/api/js?sensor=false&callback=gm_initialize";
    to
    script.src = "//maps.googleapis.com/maps/api/js?sensor=false&callback=gm_initialize";
    ———
    6) in /sys/app/models/user.php line 179 change
    return 'http://www.gravatar.com/avatar/' . md5($email) . '.jpg?s=' . $size . '&d=' . $type;
    to
    return '//www.gravatar.com/avatar/' . md5($email) . '.jpg?s=' . $size . '&d=' . $type;
    ———
    7) in /sys/libraries/recaptchalib.php on line 240 change
    return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail);
    to
    return "//www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail);

    ————–
    If you have difficulties to make those changes let us know and we can make those changes and send to you.

    Regards.

    #3643 Reply

    Peter_Pan
    Participant

    Worked like a charm. TY

    #3645 Reply

    Peter_Pan
    Participant

    Any suggestion on htaccess code to redirect http to https? Or any changes to enable this?

    #3647 Reply

    ClassiBase
    Keymaster

    Try adding this to your .htaccess file

    RewriteCond %{HTTPS} off
    RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: Site breaks when installing SSL certificate
Your information: