[eluser]@robertotra[/eluser]
Do not know if it can be done by url rewriting, but it can be done for sure inside the index.php on its top by using the server variable $_SERVER['HTTPS']:
Code:
session_start();
if (empty($_SERVER['HTTPS'])
{
/* to avoid a potential infinite cicle of redirections, uses a session variable as a flag */
if ((! isset($_SESSION['redirected'])) || ($_SESSION['redirected'] != 'yes')) {
$_SESSION['redirected'] = 'yes';
header('Location: https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']);
exit;
} else {
// something wrong, your error catching procedure here
}
} else {
// you are on https, reset flag
$_SESSION['redirected'] = 'no';
}
Anyway, any rewriting or redirection will non ensure images and stylesheets to be loaded by https until you use relative paths. You need to use absolute paths starting with https.
Code:
$GLOBALS['imageDir'] = 'https://yoursite.ext/images/';
<img src="<?php echo $GLOBALS['imageDir']; ?>yourimage.gif">
Roberto