httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lyle Wincentsen <lyle.wincent...@gmail.com>
Subject Re: [users@httpd] how to setup mod_ssl to accept only https requests
Date Thu, 18 Jun 2009 07:16:53 GMT
>Davide wrote:
>You have two way: remove the 'Listen 80' option, basically disabling the
>whole http part, or add a 'RedirectPermanent / https:...' to the default
>http vhost to redirect all the http request to https.

You could also call the following php function at the top of each page
where you want to use SSL:

function redirect_to_https() {
if ($_SERVER['HTTPS']!="on") {
      $redirect =
"https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'<https://%22.$_server['http_host'].$_server['request_uri'/>
];
      header("Location:$redirect");
   }
}
-Lyle

Mime
View raw message