Page 1 of 1

Admin Panel not loading after SSL is enabled.

Posted: Wed Jun 13, 2018 1:51 pm
by devtester478
I am using Opencart 2.3.0.2 version and trying to make the site work with SSL. I enabled SSL from the Admin > Setting > Server and enabled SSL setting. After that I modified URLs in the config.php file of admin folder:

// HTTP
define('HTTP_SERVER', 'http://www.siteurl.com/admin/');
define('HTTP_CATALOG', 'http://www.siteurl.com/');
define('HTTP_IMAGE', 'http://www.siteurl.com/image/');

// HTTPS
define('HTTPS_SERVER', 'https://www.siteurl.com/admin/');
define('HTTPS_CATALOG', 'https://www.siteurl.com/');
define('URL_CUTSHEET', 'https://www.siteurl.com/image/catalog/cutsheets/'); // custom variable to get cutsheet folder url

Then I modified config.php of the root directory.

// HTTP
define('HTTP_SERVER', 'http://www.siteurl.com/');

// HTTPS
define('HTTPS_SERVER', 'https://www.siteurl.com/');
define('URL_CUTSHEET', 'https://www.siteurl.com/image/catalog/cutsheets/'); // custom variable to get cutsheet folder url

After making these changes when I am trying to login to admin panel I am getting an error that "Site cannot be reached."

Also, when I change
define('HTTP_SERVER', 'http://www.siteurl.com/');
to
define('HTTP_SERVER', 'https://www.siteurl.com/');

The frontend CSS and JS files won't load and not loading the correct layout of the site.

Can you guys help me to get this working?

Thanks in Advance.

Re: Admin Panel not loading after SSL is enabled.

Posted: Thu Jun 14, 2018 2:29 am
by IP_CAM
Also rewrite HTTP_ to https:// ... :

Code: Select all

define('HTTP_SERVER', 'https://www.siteurl. .....
define('HTTP_CATALOG', 'https://www.siteurl. .....
define('HTTP_IMAGE', 'https://www.siteurl. ..... 
in BOTH config.php files.
Ernie

Re: Admin Panel not loading after SSL is enabled.

Posted: Thu Jun 14, 2018 12:45 pm
by devtester478
I tried this too but admin panel won't load and on frontend all the js and css files won't load.

Re: Admin Panel not loading after SSL is enabled.

Posted: Fri Jun 15, 2018 2:34 am
by IP_CAM
Well, then, it's time, to either share the Shop URL, or then, get a Pro!
Ernie

Re: Admin Panel not loading after SSL is enabled.

Posted: Tue Jun 26, 2018 1:53 pm
by devtester478
Hey,

Thanks for your response. I fixed the issue of SSL. Now I am facing the issue that when the site is loaded using example.com then it is redirecting to the https://www.example.com but when I am loading the site with www.example.com then it is not redirecting to https URL. I tried to add code in .htaccess for the www.example.com, in that case, I am getting an error of too many redirects and the site went down.

Here is my htaccess code:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]

This is the when i add then site went down

RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]

Can anyone help me with this, please.

Thanks

Re: Admin Panel not loading after SSL is enabled.

Posted: Wed Mar 31, 2021 4:55 pm
by alin301
I had this issue with my websites several times and the problem came from Google Pagespeed extension in my cPanel. I solved this by adding the following code to my .htaccess root file.

Code: Select all

ModPagespeedDisableFilters combine_css