Jump to content

SSL Enabled HTTPS causes links to HTTP to be port 443


Recommended Posts

I just installed Prestashop and I'm having an issue with SSL enabled. When I checkout it goes to a secure HTTPS page; however all the links on the right menu are HTTP with port 443. When I click the link it doesn't work. Is there anyway to change it so that port 443 is not appended to non-SSL pages.

In the screenshot, I'm in the authentication.php page which is HTTPS, but when I click the "Accessories" category the link is HTTP with port 443 instead of port 80. Not sure how to fix this.

11029_EfiYncnRD0eaMsPrps23_t

Link to comment
Share on other sites

I put in a workaround. The problem is in the $_SERVER['HTTP_HOST'] variable which includes the port of the current page. This makes sense when your in HTTPS, but when going back to HTTP it doesn't. I've noticed in some live prestashops that once in HTTPS, all pages are HTTPS even the catalog browsing.

Because my host uses the default SSL port 443 for HTTPS, I just modified the init.php file and inserted a line to search for port 443 and delete it from the $_SERVER['HTTP_HOST'] variable. Quick and dirty.

if (strpos($_SERVER['HTTP_HOST'],":443")>1)
$_SERVER['HTTP_HOST'] = str_replace(":443","",$_SERVER['HTTP_HOST']);

Link to comment
Share on other sites

  • 2 months later...

hello,

I wanted to say that I was having the same problem - any dynamically generated links on my HTTPS pages were redirecting to HTTP://myurl:443... i'm on MediaTemple here, and found a similar fix for WordPress at: http://docs.shopplugin.net/Media_Temple_SSL_Redirect_Loop

i inserted this line in my init.php file on line 107 (second line of Server Params section)...
$server_host = str_replace(':443', '', $server_host);

seems to be working so far...

Link to comment
Share on other sites

  • 4 months later...
  • 1 month later...
Hello, none of these solutions work for me.
If I edit my init. file, my site comes up empty! Nothing. If I restore the original file the site comes up...


OK... so I at Mediatemple and none of the items above worked for me,

I changed this:
/* Server Params */
$server_host = htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8');
$protocol = 'http://';
$protocol_ssl = 'https://';


to This:

/* Server Params */
$server_host = htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8');
$protocol = 'https://';
$protocol_ssl = 'https://';

It's working great!
Link to comment
Share on other sites

  • 1 month later...

Just wondering if anyone has an alternate solution for this issue? My server can get slow sometimes and having all pages in SSL would make it too slow.

And FYI, I'm running 1.3.1.1 and the solutions in posts #2 and #6 don't work in this version.

The one in #9 does work, but I'd rather only have SSL enabled on checkout and account pages.

Thanks in advance for any help!

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...