Skip to content

Instantly share code, notes, and snippets.

@putzflorian
Created January 30, 2015 08:27
Show Gist options
  • Select an option

  • Save putzflorian/1c8c8163ee6dbdd54763 to your computer and use it in GitHub Desktop.

Select an option

Save putzflorian/1c8c8163ee6dbdd54763 to your computer and use it in GitHub Desktop.
SSL redirect for Pimcore
<?php
// SSL redirect
if(!$this->editmode){
if($this->document instanceof Document_Page){
$domain = 'www.domain.tld';
if($this->document->getProperty('https') && !$this->getRequest()->isSecure()){
Pimcore_Model_Cache::disable();
$this->_redirect('https://' . $domain . $document_path, array('code' => 301));
} elseif(!$this->document->getProperty('https') && $this->getRequest()->isSecure()){
Pimcore_Model_Cache::disable();
$this->_redirect('http://' . $domain . $document_path, array('code' => 301));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment