Tuesday, 15 March 2016

find current url is with http or https in php

<?php if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") {
   $protocol= "https://";
} else {
    $protocol= "http://";
} echo $protocol.$_SERVER['SERVER_NAME']; ?>

No comments:

Post a Comment