Jump to content

Entire shop accessible via HTTPS and HTTP


webmotion

Recommended Posts

I've just started some SEO work on a PrestaShop website.

 

For some reason, the entire site is available on both https and http, which as you can imagine is causing duplicate content issues.

 

http://corsagecreations.co.uk/

https://corsagecreations.co.uk/

 

Is there any way to resolve this? Ideally only customer and checkout areas should be forced to use https.

Link to comment
Share on other sites

I think I *may* have resolved this by taking some code from the latest version.

 

I've edited FrontController.php by replacing the following:

$useSSL = $this->ssl;

With:

if (Configuration::get('PS_SSL_ENABLED') && Configuration::get('PS_SSL_ENABLED_EVERYWHERE'))
$this->ssl = true;

if (isset($useSSL))
$this->ssl = $useSSL;
else
$useSSL = $this->ssl;

I've also replaced:

		if ($this->ssl AND !Tools::usingSecureMode() AND Configuration::get('PS_SSL_ENABLED'))
		{
			header('HTTP/1.1 301 Moved Permanently');
			header('Cache-Control: no-cache');
			header('Location: '.Tools::getShopDomainSsl(true).$_SERVER['REQUEST_URI']);
			exit();
		}

With:

// 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');
if ($this->ssl)	
header('Location: '.Tools::getShopDomainSsl(true).$_SERVER['REQUEST_URI']);
else	
header('Location: '.Tools::getShopDomain(true).$_SERVER['REQUEST_URI']);
exit();
}

Can you see any potential issues there?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...