testing for https

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
   I'd like to test whether a connection is secure or not, ie http, or
https so I can redirect to the https if need be.  Seems like there
should be a php function for  that...


Re: testing for https

Quoted text here. Click to load it


Re: testing for https

Jeff escribió:
Quoted text here. Click to load it

In a properly configured installation of Apache + mod_ssl you have the
$_SERVER['HTTPS'] variable set to "on". You can check all values with:

<?php print_r($_SERVER); ?>

I'm unsure about other server setups but you should find a proper value
in $_SERVER.

You could also consider letting this task to the web server. In Apache
it's quite easy to write a redirect at virtual host level.

-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor al baño María: http://www.demogracia.com

Re: testing for https

Quoted text here. Click to load it

If you don't seperate your SSL and non-ssl traffic into seperate
vhosts you're just asking for trouble. As others have said, the info
is in the CGI parameters - but that's not the right way to do it.


Site Timeline