This topic is locked

Best SSL HTTPS Method for PHPRUNNER

8/30/2011 2:14:49 AM
PHPRunner General questions
M
MikeB941 author

PHPRUNNER 5.3 BUILD 7474
Have read all the posts (I think) but just wanted to double check on the best method of implementing SSL / HTTPS with PHPRUNNER.
I just added this code to the top of dbcommon.php and it appears to be doing the job:
if($HTTP_SERVER_VARS["HTTPS"] != "on")

{

$newurl = "https://"; . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];

header("location: $newurl");

}
I was just wondering how much overhead this might introduce?
There was also the suggestion to do this via the Apache htaccess (some examples):
RewriteEngine On

RewriteCond %{HTTPS} off

RewriteRule (.) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteCond %{HTTPS} !=on

RewriteRule .
https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
If there is a "best practice" of using PHPRUNNER with SSL / HTTPS I'd sure appreciate the advise.

C
cgphp 8/30/2011

$HTTP_SERVER_VARS is deprecated. Use $_SERVER instead.

if($_SERVER['HTTPS'] != "on")

{

$redirect= "https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI';];

header("Location:".$redirect);

}



Overhead? Read this: http://stackoverflow.com/questions/548029/how-much-overhead-does-ssl-impose

Sergey Kornilov admin 8/30/2011

I would suggest to use web server redirect in this case via .htaccess.