Redirect to HTTPS

duffhome

Active Member
Hello guys,

I was wondering if there's a way to force redirection to HTTPS without using .htaccess. and without having to install SSL Cert on the tracking domains?

Using PHP maybe? I found this code. where I can implement it?


PHP:
if(empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == "off"){
    $redirect = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    header('HTTP/1.1 301 Moved Permanently');
    header('Location: ' . $redirect);
    exit();
}

Thanks
Iss.
 
Yes that is correct, but you can only do redirect to https for the domain that has ssl cert, for the others, you can leave them on http.
 
In a case that the main domain has SSL. and the tracking domain does not have SSL. .htaccess will work fine?
 
Hello guys,

I was wondering if there's a way to force redirection to HTTPS without using .htaccess. and without having to install SSL Cert on the tracking domains?

Using PHP maybe? I found this code. where I can implement it?


PHP:
if(empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == "off"){
    $redirect = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    header('HTTP/1.1 301 Moved Permanently');
    header('Location: ' . $redirect);
    exit();
}

Thanks
Iss.
...that is pretty much what goes into htaccess, so to do an extension for this php code which is already more than what goes into htaccess is like reinventing the wheel with more width even though we want things faster...but, there could be benefits in an extension:
# convenience by webform (no knowledge of htaccess required by marketing user)
# multiple choices for various domains (ie easier to handle many clients)
# nice place to add more security features


In a case that the main domain has SSL. and the tracking domain does not have SSL. .htaccess will work fine?
...you can define this in the htaccess file(s)
 
Back
Top