Thursday, 29 June 2017

How to check is WEBSITE https secure or not in php

 Above single line of php code will help you to get whether current URL over https or http.
 
 
<?= ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443) ? 'https' : 'http'; ?>

No comments:

Post a Comment