Tech Force One is my web log related to technologies, I use day to day.


Search Tech Sites:
Loading

PHP redirection to HTTPS SSL »

If you wish to redirect one of your pages to HTTPS, even when user enters HTTP in the URL, you can use the following lines of code before you load your PHP page.

if (empty($_SERVER['HTTPS']) || ($_SERVER['HTTPS']!=”on”))
{
$redirect= “https://”.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
header(“Location:$redirect”);
}