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...
What's the PHP for....
- AYHJA
- 392
- Posts: 37990
- Joined: Fri Sep 17, 2004 2:25 pm
- Location: Washington, D.C.
- Contact:
-
- Site Admin
- Posts: 2411
- Joined: Sat Nov 06, 2004 4:43 am
- Location: Sydney, Australia
- Contact:
Is this to add inside the script itself to REDIRECT to http, if the user visits via https?
BBcode: | |
Hide post links |
- AYHJA
- 392
- Posts: 37990
- Joined: Fri Sep 17, 2004 2:25 pm
- Location: Washington, D.C.
- Contact:
-
- Site Admin
- Posts: 2411
- Joined: Sat Nov 06, 2004 4:43 am
- Location: Sydney, Australia
- Contact:
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..
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..
BBcode: | |
Hide post links |