Detecting HTTPS vs HTTP on server sending back nothing useful

So kind of very similar to "Detecting https requests in php":

Want to have go to or even vice versa.


  • Can't read anything from $_SERVER["HTTPS"] since it's not there
  • Server is sending both requests over port 80, so can't check for 443 on the HTTPS version
  • apache_request_headers() and apache_response_headers() are sending back the same thing
  • Can't tell the loadbalancer anything or have it send extra somethings
  • Server feedback data spat out by the page on both URL calls is exactly the same save for the session ID. Bummer.

Are there any on page ways to detect if it's being called via SSL or non-SSL?

Edit: $_SERVER["HTTPS"] isn't there, switched on or not, no matter if you're looking at the site via SSL or non-SSL. For some reason the hosting has chosen to serve all the HTTPS requests encrypted, but down port 80. And thusly, the $_SERVER["HTTPS"] is never on, not there, just no helpful feedback on that server point. So that parameter is always be empty.

(And yeah, that means it gets flagged in say FF or Chrome for a partially invalid SSL certificate. But that part doesn't matter.)

Also, the most that can be gotten from detecting the URL is up to the point of the slashes. The PHP can't see if the request has https or http at the front.