if($_SERVER["HTTPS"] != 'on' || substr($_SERVER["HTTP_HOST"], 0, 3) != 'www') {
if(substr($_SERVER["HTTP_HOST"], 0, 3) != 'www') {
$strLocation = "https://www.".$_SERVER["HTTP_HOST"].$_SERVER['SCRIPT_NAME'].$_SERVER["QUERY_STRING"];
}
else {
$strLocation = "https://".$_SERVER["HTTP_HOST"].$_SERVER['SCRIPT_NAME'].$_SERVER["QUERY_STRING"];
}
header("Location: ".$strLocation);
}
Adding this to the page you want to be https will ensure the URI reads https://www.yourDomain.com/.
Also, include the code below in the same page. It might be an idea to include the code below on everypage.
if($_SERVER["HTTPS"]=='on') {
echo("<base href=\"https://www.yourDomain.com/\" />");
}
else {
echo("<base href=\"http://www.yourDomain.com/\" />");
}
If your images are called like: images/anImage.gif instead of http://www.yourDomain.com/images/anImage.gif then the above will work, otherwise you'll need to change all image locations to be relative instead of absolute.