Post by derv.god » Wed Apr 13, 2016 5:50 pm

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 !

Newbie

Posts

Joined
Wed Apr 13, 2016 1:35 pm

Post by derv.god » Thu Apr 14, 2016 4:42 am

Here is a screenshot of where multiple .js and image files return a 404 not found on get method.

Attachments

404.JPG

404.JPG (25.85 KiB) Viewed 3713 times


Newbie

Posts

Joined
Wed Apr 13, 2016 1:35 pm

Post by derv.god » Thu Apr 14, 2016 11:48 pm

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
Last edited by straightlight on Wed Jul 27, 2016 2:38 am, edited 2 times in total.
Reason: Added code tags.

Newbie

Posts

Joined
Wed Apr 13, 2016 1:35 pm

Post by ironsleek » Sat Apr 30, 2016 6:41 am

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

Newbie

Posts

Joined
Mon Aug 27, 2012 12:51 am

Post by Samboc » Wed May 18, 2016 2:09 pm

This solution worked but I found I had trouble searching.

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

Thanks derv.god

Newbie

Posts

Joined
Wed May 18, 2016 2:04 pm

Post by recseiuq » Sat Jun 11, 2016 6:55 am

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.

Newbie

Posts

Joined
Sat Jun 11, 2016 6:53 am

Post by Nicarlo » Mon Jul 11, 2016 6:00 am

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

Newbie

Posts

Joined
Mon Jun 06, 2016 4:32 am

Post by lagos911 » 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

Newbie

Posts

Joined
Thu Jun 08, 2017 11:19 pm

Post by pbianco » Fri Oct 19, 2018 11:34 pm

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 . '/';

Newbie

Posts

Joined
Sat May 21, 2016 1:37 am
Who is online

Users browsing this forum: No registered users and 14 guests