Page 2 of 2

Re: Configuring files for SSL

Posted: Sun Mar 26, 2017 6:04 pm
by victorj
Oc 2.2 has more bugs when running entire site ssl.
Editing orders needs to be fixed as well.
URL.php needs fixing.

When starting a new shop i would recomend of 2.3.0.2, most bugs are fixed there, although it has some unwanted behavior as well.

Re: Configuring files for SSL

Posted: Sun Mar 26, 2017 7:24 pm
by artcore
Just found another issue for OC2.1.0.2, others might have it too.

In catalog/controller/checkout/confirm.php
line 100: $order_data['store_url'] = HTTP_SERVER;
should be
$order_data['store_url'] = $this->config->get('config_seo_url') ? HTTPS_SERVER : HTTP_SERVER;

Error in console: Blocked loading mixed active content “http://...................../index.php?route=api/login” and of course that 'error undefined' popup

EDIT: This only fixes future orders. For existing orders you need to chnage the store_url in the 'orders' table from http... to https

@victorj:
It's not always easy to just upgrade. It is however easy for OC to release maintenance versions that tackle these widely known OC issues. Unfortunately the fixes only end up in newer versions if you're lucky, which have their own problems and the cycle never ends.

Re: Configuring files for SSL

Posted: Mon Mar 27, 2017 5:05 pm
by winter
Hi everyone,

A big thank you to everyone who has contributed to this thread. I had done the basics in the config files and .htaccess but in the end it came down to having to change the code in the system/library/url.php

This is where the problem lies with version 2.2, so now it is (hopefully) solved!

Many thanks again and if you ever need to shop for ambient music, you can now do so safely here:-

https://www.winter-light.nl/

Thanks again.

Mark

Re: (RESOLVED) Configuring files for SSL

Posted: Wed Mar 29, 2017 1:59 pm
by winter
I was hoping this was totally solved but after successfully completing the SSL codes some of the sub categories no longer display from the categories menu below the main header menu.

New thread?

Re: (RESOLVED) Configuring files for SSL

Posted: Wed Mar 29, 2017 2:56 pm
by artcore
Goedemorgen,

I don't think this is to do with SSL although I'm not sure exactly you meant by subcats not showing. I did notice you don't have a redirect from non-www to www which is important. This can be done by htaccess - plenty of examples on the forum on how to do this.
Also it might be your - rather slow btw - custom theme.

Re: (RESOLVED) Configuring files for SSL

Posted: Wed Mar 29, 2017 4:07 pm
by winter
Goedemorgen!

Yes the theme is a bit slow. Having just spent shed loads of time on it I'm loathe to change to a new one just yet.
From the categories menu if you select Genre>Ambient it doesn't load the page up.

https://www.winter-light.nl/store/Genre/Ambient

It was doing this fine until I changed the code for the SSL.
I haven't done anything since then to the back end.

I think my .htacces file is in a bit of a mess maybe? :crazy:

Re: (RESOLVED) Configuring files for SSL

Posted: Wed Mar 29, 2017 5:23 pm
by artcore
Your base href is missing so a lot of resources are not found. Could be your theme, could be OC.

Possible fix. In common/header controller
Find: $data['base'] = $server;
Replace: $data['base'] = HTTPS_SERVER;
If you don't use multistores this should be fine.
refresh modification cache after any edits

BTW if it's not too late for a new theme. This one uses a shitload of javascript and not exactly in an optimized way.

Re: (RESOLVED) Configuring files for SSL

Posted: Wed Mar 29, 2017 6:13 pm
by winter
Thanks for your help artcore.

Did you check the link for the categories?
Its trying to load the page but if you scroll down you just see a tiny band of activity at the top of the page.
All non-formatted junk basically.

Base href is btw?
I'm also leaning towards a new theme as this one is only good for 2.2 with no sign of an update and yes agreed it is slow...... :)

Can I PM you my .htaccess file?

I think there is a lot of unnecessary code in there.

Re: (RESOLVED) Configuring files for SSL

Posted: Wed Mar 29, 2017 6:36 pm
by artcore
Yes I did. Nothing loads because resources aren't found like jQuery which has a lot of dependencies.
Sure mail (support[at]ilithemes(d o t)com me the htaccess and I'll send one over that is proven to work for OC. Also give me which Apache version you're using on the server. < 2.4 ?

Re: (RESOLVED) Configuring files for SSL

Posted: Wed Mar 29, 2017 6:54 pm
by winter
Thanks a lot! :)
Will send it over. O0

Re: (RESOLVED) Configuring files for SSL

Posted: Fri Mar 31, 2017 4:16 pm
by vahidafshari
All pages must be HTTPs protocol. So Redirect 301 all pages in htaccess

Re: (RESOLVED) Configuring files for SSL

Posted: Fri Mar 31, 2017 5:24 pm
by sculptex
Yes, its important to have the redirect to HTTPS in place using a 301 (permanent) redirect and the amendments to htaccess shown earlier in this topic cover that, but don't just rely on that, its important that all store config settings, sitemaps and all incoming links are also updated where possible so that they don't rely on the redirect which uses additional resources.

Re: (RESOLVED) Configuring files for SSL

Posted: Thu May 04, 2017 5:10 pm
by android30t
hi.
i had same problem in my sites.
دانلود بازی اندروید
and
دانلود برنامه اندروید

thank you for this topic.

Re: (SOLVED) Configuring files for SSL

Posted: Sun May 19, 2019 8:47 pm
by michael2820
Qphoria wrote: "So you see in your config.php there is a HTTP and an HTTPS section which are relative to that design. If you want all pages to load over https, then simply set https:// for both HTTP_SERVER and HTTPS_SERVER."

Just what I was looking for ! thanks

Re: Configuring files for SSL

Posted: Mon Sep 28, 2020 9:54 am
by abdulhadi
artcore wrote:
Sun Mar 26, 2017 5:59 pm
There's only a few steps to take:

- change both config.php files: HTTPS_SERVER entry, http->https. Should be default config for opencart.

Code: Select all

// HTTPS
define('HTTPS_SERVER', 'https://yourdomain.tld');
Admin->settings>store check SSL

Important but often forgotten, change your htaccess to redirect to non-www AND https if not entered/clicked from google by the visitor. This will also make sure the fonts are loaded and ajax + api callls work as intended

Code: Select all

RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^(.*) https://yourdomain.tld%{REQUEST_URI} [R=301,L,NE]
RewriteBase /
RewriteBase is the relative folder where you installed the shop.

For OC2.2.0.0 use above fix for url.php as well.

Make sure images in stylesheets for instance are not hard coded to use http without 's'. Same for images in product description and information pages.
Although, this thread is old. I just like to say this help me solve my broken image problem. Thank you :D