Amazing what you can fix when you re-copy. This is solved, the original code worked.
Be careful with that approach - the redirect will drop any query parameters attached to the url.
I use something like this (using a TV to choose between http and https schemes):
// Is this currently a secure connection?
$ssl = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on';
// Get the https TV that may be set for this page
$val = $modx->resource->getTVValue('HTTPS');
if ($val == 'Yes' && !$ssl) {
$redirect = "https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$modx->sendRedirect($redirect);
exit();
} elseif ($val != 'Yes' && $ssl) {
$redirect = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$modx->sendRedirect($redirect);
exit();
}
lo9on.com
MODx Evolution/Revolution | Remote Desktop Training | Development