diff --git a/classes/controller/FrontController.php b/classes/controller/FrontController.php index 3117d655f..c5ce065ad 100755 --- a/classes/controller/FrontController.php +++ b/classes/controller/FrontController.php @@ -114,21 +114,18 @@ class FrontControllerCore extends Controller $css_files = $this->css_files; $js_files = $this->js_files; - if ($this->ssl && !Tools::usingSecureMode() && Configuration::get('PS_SSL_ENABLED')) - { + // If we call a SSL controller without SSL or a non SSL controller with SSL, we redirect with the right protocol + if (Configuration::get('PS_SSL_ENABLED') && ($_SERVER['REQUEST_METHOD'] != 'POST') && $this->ssl != Tools::usingSecureMode()) + { header('HTTP/1.1 301 Moved Permanently'); header('Cache-Control: no-cache'); - header('Location: '.Tools::getShopDomainSsl(true).$_SERVER['REQUEST_URI']); + if ($this->ssl) + header('Location: '.Tools::getShopDomainSsl(true).$_SERVER['REQUEST_URI']); + else + header('Location: '.Tools::getShopDomain(true).$_SERVER['REQUEST_URI']); exit(); } - elseif (Configuration::get('PS_SSL_ENABLED') && Tools::usingSecureMode() && !($this->ssl)) - { - header('HTTP/1.1 301 Moved Permanently'); - header('Cache-Control: no-cache'); - header('Location: '.Tools::getShopDomain(true).$_SERVER['REQUEST_URI']); - exit(); - } - + if ($this->ajax) { $this->display_header = false;