I have worked it out in a round about way.
I created an extra function along the lines as one shown here http://doc.silverstripe.org/ssl?s[]=secure&s[]=pages
public function init() {
parent::init();
if (!Director::isDev()) {
if ( !$this->SecurePage()) {
$this->force_HTTP();
} else {
$this->force_HTTPS();
}
}
}
// if we are on https, redirect to the http version of this page's URL
function force_HTTP() {
$page_url = Director::absoluteURL( $_SERVER['REQUEST_URI'] );
$https_regex = '{^https:}';
if ( preg_match( $https_regex, $page_url ) ) {
$new_url = preg_replace( $https_regex, 'http:', $page_url );
Director::redirect('http://www.domain.com'.$this->Link());
}
}
function force_HTTPS() {
$page_url = Director::absoluteURL( $_SERVER['REQUEST_URI'] );
$https_regex = '{^http:}';
if ( preg_match( $https_regex, $page_url ) ) {
$new_url = preg_replace( $https_regex, 'https:', $page_url );
Director::redirect('https://secure.domain.com'.$this->Link());
}
}
Declaring in the class
function SecurePage() {
return false;
}
It may not be 100% right but it appears to work the way I need it to.
If anyone has any suggestions to improve would be greatly appreciated.