My server is set up that any php file can be invoked using http or https.
I want to ensure that for some pages only https is acceptable.
Is there a variable in PHP that will give me the full URL including the protocol. I can then do a test and redirection.
TANSTAAFL!! sleipnir you put me on the right track.
My testing may be of use to future programmers looking for the same indicator:
I wrote a little php routine to list all the members of $_SERVER. Nothing useful showed up except the server port (which was 80) as I had invoked the program using http.
When I tested the same routine using https, the port changed to 443, so I have an indicator. THEN I noticed that there was a new element called HTTPS (it did not show up in the first test not having been set) with a value of "on".
This is a much more direct test and it works well.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.