}
if (!empty($sn)) {
- if (!empty($sn->hostname) && 0 != strcasecmp($sn->hostname, $servername)) {
- $sn->redirectToHostname();
+
+ // Redirect to the right URL
+
+ if (!empty($sn->hostname) &&
+ empty($SERVER['HTTPS']) &&
+ 0 != strcasecmp($sn->hostname, $servername)) {
+ $sn->redirectTo('http://'.$sn->hostname.$_SERVER['REQUEST_URI']);
+ } else if (!empty($SERVER['HTTPS']) &&
+ 0 != strcasecmp($sn->sitename.'.'.$wildcard, $servername)) {
+ $sn->redirectTo('https://'.$sn->sitename.'.'.$wildcard.$_SERVER['REQUEST_URI']);
}
+
$dbhost = (empty($sn->dbhost)) ? 'localhost' : $sn->dbhost;
$dbuser = (empty($sn->dbuser)) ? $sn->nickname : $sn->dbuser;
$dbpass = $sn->dbpass;
// (C) 2006 by Heiko Richler http://www.richler.de/
// LGPL
- function redirectToHostname()
+ function redirectTo($destination)
{
- $destination = 'http://'.$this->hostname;
- $destination .= $_SERVER['REQUEST_URI'];
-
$old = 'http'.
(($_SERVER['HTTPS'] == 'on') ? 'S' : '').
'://'.