Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

force https redirect php

if (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] === "off") {
    $location = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    header('HTTP/1.1 301 Moved Permanently');
    header('Location: ' . $location);
    exit;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #force #https #redirect #php
ADD COMMENT
Topic
Name
2+5 =