Post by R_D » Tue Apr 19, 2016 8:13 pm

Who can help me out:

I've installed a clean OC 2.2.0.0 on a subdomain and want to force SSL on all pages.
I've altered the

Code: Select all

$_['site_ssl']          = false;
in the System/Config/admin.php, catalog.php and default.php to

Code: Select all

$_['site_ssl']          = true;
because if you only enable SSL in the admin site config, nothing happens.

Also I've changed the System/Library->url.php

Code: Select all

$url = 'http://' . $_SERVER
to

Code: Select all

$url = 'https://' . $_SERVER
to force https

The urls in config.php and admin/config.php are adjusted to https.

The .htaccess file is renamed and I've inserted the following code

Code: Select all

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
All is well, the site is forced into SSL BUT it only works for (SEO) urls without 'children':

https://store.mydomain.com/category works (but not if you add a '/' to the end of the url)
but

https://store.mydomain.com/category/category-child or
https://store.mydomain.com/category/product

doesn't work; the CSS is broken.

CSS files like /catalog/view/theme/default/stylesheet/stylesheet.css and JS like /catalog/view/javascript/bootstrap/js/bootstrap.min.js are being added after the https://store.mydomain.com/category becoming https://store.mydomain.com/category/catalog/view/theme/default/stylesheet/stylesheet.css


How can I fix this?

R_D
Active Member

Posts

Joined
Sun Jan 09, 2011 3:13 am

Post by derv.god » Wed Apr 20, 2016 12:59 am

Hi,
I had the exact same problem. I have posted the answer in my thread.

http://forum.opencart.com/viewtopic.php?f=190&t=160983

If you find a different solution to this please let me know. It has been a pain finding the problem->solution.


Regards

Newbie

Posts

Joined
Wed Apr 13, 2016 1:35 pm

Post by R_D » Wed Apr 20, 2016 3:24 am

Good lord, you've saved my day ;D

I encountered 1 problem with it: if you do what you said in the other post you can't search because you're missing a "/".
in catalog/controller/common/header.php on line 27
your code:

Code: Select all

$data['base'] = "//mydomain.com";
Code so search is working:

Code: Select all

$data['base'] = "//mydomain.com/";
Last edited by R_D on Tue May 31, 2016 11:43 pm, edited 1 time in total.

R_D
Active Member

Posts

Joined
Sun Jan 09, 2011 3:13 am

Post by Randem » Wed Apr 20, 2016 7:43 am

The solutions for this can be found here - Changes made to correct issues in OpenCart for v2.2.0.x

You will run into other issues in V2.2.0.0 with SSL - OpenCart 2.2.0.0 Testing - Issues to Expect...

NEVER take serious; anyone who gives negative impact statements with no ABSOLUTE proof!
OpenCart Helpful Information * Upgrade 1.5 to 2.1 * Upgrade 2.1 to 2.2
"Why do people NEVER have enough time to do it right but ALWAYS enough time to do it over?"
DO NOT EVER GIVE SOMEONE YOU DON"T KNOW ADMIN ACCESS TO ANYTHING!
I am NOT affiliated with OpenCart


User avatar
Active Member

Posts

Joined
Sat Sep 27, 2014 9:17 am

Post by R_D » Wed Apr 20, 2016 2:02 pm

Hi Randem,

I've already seen your post and seen the files attached but this problem couldn't be solved with that (as far as I know).

R_D
Active Member

Posts

Joined
Sun Jan 09, 2011 3:13 am

Post by Randem » Wed Apr 20, 2016 2:33 pm

How did you come to determine that? Hopefully not just by looking at it...I post the fixes because they work and I use forced SSL.

NEVER take serious; anyone who gives negative impact statements with no ABSOLUTE proof!
OpenCart Helpful Information * Upgrade 1.5 to 2.1 * Upgrade 2.1 to 2.2
"Why do people NEVER have enough time to do it right but ALWAYS enough time to do it over?"
DO NOT EVER GIVE SOMEONE YOU DON"T KNOW ADMIN ACCESS TO ANYTHING!
I am NOT affiliated with OpenCart


User avatar
Active Member

Posts

Joined
Sat Sep 27, 2014 9:17 am

Post by R_D » Wed Apr 20, 2016 2:40 pm

Haha, no not by only looking at it, :laugh: :laugh: I've incorporated most fixes (thanks for that by the way)

R_D
Active Member

Posts

Joined
Sun Jan 09, 2011 3:13 am

Post by Randem » Wed Apr 20, 2016 2:47 pm

You are welcome 8) Some humor is needed in life :laugh:

NEVER take serious; anyone who gives negative impact statements with no ABSOLUTE proof!
OpenCart Helpful Information * Upgrade 1.5 to 2.1 * Upgrade 2.1 to 2.2
"Why do people NEVER have enough time to do it right but ALWAYS enough time to do it over?"
DO NOT EVER GIVE SOMEONE YOU DON"T KNOW ADMIN ACCESS TO ANYTHING!
I am NOT affiliated with OpenCart


User avatar
Active Member

Posts

Joined
Sat Sep 27, 2014 9:17 am

Post by R_D » Wed May 25, 2016 12:15 am

Something strange happens when I want to view an order:

I receive an"Error undefined" message. When I use Chromes developers console I can see this:

XMLHttpRequest cannot load httpss://shop.myshop.com/index.php?route=api/login. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.

Take note of the "httpss" it's not a typo :choke:

Anyone some ideas to solve this?

R_D
Active Member

Posts

Joined
Sun Jan 09, 2011 3:13 am

Post by R_D » Wed May 25, 2016 7:06 pm

For anyone with the same problem:

https://github.com/opencart/opencart/pull/4353/files

This is the solution...

R_D
Active Member

Posts

Joined
Sun Jan 09, 2011 3:13 am

Post by OMDB » Sat May 28, 2016 11:34 pm

This works for me:

Code: Select all

      if ($this->request->server['HTTPS']) {
            $server = 'https://'.$this->config->get('site_base');
      } else {
            $server = $this->config->get('config_url');
      }
Thus, no need to hardcode the actual domain in the code.

Newbie

Posts

Joined
Sat May 28, 2016 11:31 pm

Post by R_D » Mon May 30, 2016 9:47 pm

OMDB wrote:This works for me:

Code: Select all

      if ($this->request->server['HTTPS']) {
            $server = 'https://'.$this->config->get('site_base');
      } else {
            $server = $this->config->get('config_url');
      }
Thus, no need to hardcode the actual domain in the code.
in what file and what line do you alter this? Thanks!

(....already have it ;) )

R_D
Active Member

Posts

Joined
Sun Jan 09, 2011 3:13 am
Who is online

Users browsing this forum: No registered users and 13 guests