Page 1 of 1

Posted: Wed Feb 07, 2007 5:39 pm
by AYHJA
Disabling a script..?

I have my Quantcast script that I want to run only on the http, and not the https...What's the php for that..? We all know my php is spotty at best, so any help here is appreciated...

Posted: Thu Feb 08, 2007 5:59 am
by WAY
Is this to add inside the script itself to REDIRECT to http, if the user visits via https?

Posted: Thu Feb 08, 2007 7:50 pm
by AYHJA
If the user visits https...

Active on http, inactive on https...

Posted: Fri Feb 09, 2007 5:27 am
by WAY
CODE<?php
function ForceHTTPS()
{
   if( $_SERVER['HTTPS'] != "on" )
   {
       $new_url = "https://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
       header("Location: $new_url");
       exit;
   }
}

ForceHTTPS(); // Perform the actual check during runtime.
?>

Just put that at the top of your PHP script..