The best way IMHO is to declare https virtual host in a separate directory then the one for the http
virtual host, of course if you don't have access to httpd.conf, it is another story...
You could use something like :
PHP Code:
if( $_SERVER["SERVER_PORT"] != 443 ) {
$url = "https://".$_SERVER["HTTP_HOST"]."/".$_SERVER["REQUEST_URI"];
header("Location: $url");
}