Answer the question
In order to leave comments, you need to log in
How to implement a check for something via http or https if a person has a website open?
Good morning!
I had a question how to use php to check through which protocol the site is open on the client and display the message "https available" exactly the message if it is via http and not any forced redirects to https
Answer the question
In order to leave comments, you need to log in
The variable$_SERVER['HTTPS']
takes a non-empty value if the request was made via the HTTPS protocol.
Note: Note that when using ISAPI with IIS, the value will be off if the request was not made over HTTPS.
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') {
// HTTPS
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question