Page 1 of 1

HTTPS Links not loading - OC 2.2

Posted: Wed Apr 13, 2016 5:50 pm
by derv.god
Hi,
I am having trouble setting up my OC 2.2 store to use HTTPS. I am struggling for the past week with this and cannot seem to fix it.

I have done the following things in order to set up HTTPS:
1. Edited config.php in admin and root and added HTTPS to HTTPS_Server/image/catalog (not to HTTP as that will make the site unusable. reasons below)
2. Edited admin.php and catalog.php from system/config/ and have set "$_['site_ssl']" to "true"
3. Enabled in admin store settings to Use SSL.

The problem is that HTTPS only works if they are not ending in a forward slash, and if they are in the format of
> https://*.com/page
example:
> https://*.com/page <- works
> https://*.com/product <- works

> https://*.com/page/ <- does not work
> https://*.com/product/ <- does not work
> https://*.com/parent-category/page/2 <- does not work
> https://*.com/parent-category/sub-cat/ <- does not work
> https://*.com/parent-category/product <- does not work

note:
- all these pages are working when in HTTP
- all pages are SEO friendly and have keywords


If anyone can give me an idea or where to look to make these pages load even in HTTPS it would be greatly appreciated.
Thank you !

Re: HTTPS Links not loading - OC 2.2

Posted: Thu Apr 14, 2016 4:42 am
by derv.god
Here is a screenshot of where multiple .js and image files return a 404 not found on get method.

Re: HTTPS Links not loading - OC 2.2

Posted: Thu Apr 14, 2016 11:48 pm
by derv.god
I have managed to fix the problem myself.

It turns out when in HTTPS the base href was set to nothing ("") which meant .js, .img and other files to be accessed from the wrong place.
I eddited catalog/controller/common/header.php on line 27

from:

Code: Select all

$data['base'] = $server;
to:

Code: Select all

$data['base'] = "//mydomain.com";
for some reason the if statement:

Code: Select all

if ($this->request->server['HTTPS']) {
		$server = $this->config->get('config_ssl');
} else {
		$server = $this->config->get('config_url');
	}
Does not work in my case. If anyone has this problem, this is the solution.


Regards

Re: HTTPS Links not loading - OC 2.2

Posted: Sat Apr 30, 2016 6:41 am
by ironsleek
This solution worked for me, but....

I'm changing a core file (i'd prefer not to) and

I can only use either www.mydomain.com or mydomain.com. The other no longer works.

Can anyone tell me how to fix this without messing up the two things above?

Thanks,

Matt

Re: HTTPS Links not loading - OC 2.2

Posted: Wed May 18, 2016 2:09 pm
by Samboc
This solution worked but I found I had trouble searching.

Added a "/" after the .com in > $data['base'] = "//mydomain.com";

Thanks derv.god

Re: HTTPS Links not loading - OC 2.2

Posted: Sat Jun 11, 2016 6:55 am
by recseiuq
Instead of hard-coding my domain name, I simply changed line 29 to this:

Code: Select all

                $data['base'] = $server . '/';
I'd love to know if this is the result of a misconfiguration somewhere else, or if it's actually a bug as it seems to be.

Re: HTTPS Links not loading - OC 2.2

Posted: Mon Jul 11, 2016 6:00 am
by Nicarlo
recseiuq wrote:Instead of hard-coding my domain name, I simply changed line 29 to this:

Code: Select all

 $data['base'] = $server . '/';
I'd love to know if this is the result of a misconfiguration somewhere else, or if it's actually a bug as it seems to be.
This solution worked for me as well!

Thank you very much

Re: HTTPS Links not loading - OC 2.2

Posted: Thu Sep 13, 2018 7:26 pm
by lagos911
hello,

Why its not working from me?

I still have the same problem with the child categories.

My opencart 2.2.0.0 run journal theme. It have to do with this problem?

Plz help

Re: HTTPS Links not loading - OC 2.2

Posted: Fri Oct 19, 2018 11:34 pm
by pbianco
Thanks derv.god!! ;D

I was trying for days to solve the exact issue and this worked!

Although I used this solution provided by recseiuq and it still works fine.

Code: Select all

$data['base'] = $server . '/';

Re: HTTPS Links not loading - OC 2.2

Posted: Thu Nov 22, 2018 5:28 am
by Hrejvik
lagos911 wrote:
Thu Sep 13, 2018 7:26 pm
hello,

Why its not working from me?

I still have the same problem with the child categories.

My opencart 2.2.0.0 run journal theme. It have to do with this problem?

Plz help
I have the same problem as you do/did. His solution didn't help and I'm using Journal as well. Have you found a solution please?