Does HTTP_HOST work as https ?

Will $_SERVER['HTTP_HOST'] be empty when a php script is accessed from a secure site (https://www.example.com) ?
LVL 11
level9wizardAsked:
Who is Participating?
 
MatthewPConnect With a Mentor Commented:
It should do yes, but environment variables are often set by the server and can be different on a per server basis. You can normally use $_SERVER['HTTPS'] which may return a value of 'on' if the page is accessed by HTTPS. To see a list of all environment variables in your server, just put

<?php
phpinfo();
?>

in a php file and call it up through a browser by http and https and see what's available to you.

Matt
0
All Courses

From novice to tech pro — start learning today.