Hardik Visa
Hardik Visa

Reputation: 323

opencart admin not working after change http to https

I am new in opencart. I want to enable SSL in opencart. So that I tried to change following file.

config.php file changes

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

// HTTPS
define('HTTPS_SERVER', 'https://example.com/');

admin/config.php file changes

// HTTP
define('HTTP_SERVER', 'http://example.com/admin/');
define('HTTP_CATALOG', 'http://example.com/');

// HTTPS
define('HTTPS_SERVER', 'https://example.com/admin/');
define('HTTPS_CATALOG', 'https://example.com/');

system/library/url.php file change (line : 16)

public function link($route, $args = '', $secure = true)

.htaccess put changes following code.

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

Admin panel change `Setting > Server > Use SSL set yes'

After above changes I can not login admin panel does not display any error message.

Upvotes: 1

Views: 9074

Answers (6)

galex
galex

Reputation: 21

Editing your config.php file in root and in admin folder to point to the https urls and .htaccess file.

Also in the system/config directory

respectively 2 files:

admin.php (for admin backend)

find

$_['site_ssl']         = false;

change it to

$_['site_ssl']         = true;

same at the file catalog.php (for frontend)

Upvotes: 2

Martin
Martin

Reputation: 1

Create new .htaccess file in admin page with only this code in it:

RewriteBase /

Upvotes: 0

Panup Pong
Panup Pong

Reputation: 1891

Easy to fix this problem. in system/library/url.php

change

if ($connection ==  'NONSSL') {
    $url = $this->url;  
} else {
    $url = $this->ssl;  
}

to

$url = $this->ssl;

This force all link to use https

Upvotes: 0

me9867
me9867

Reputation: 1599

To make the entire site SSL which is now the trend (like on amazon.co.uk etc) and gives a little SEO boost. I had to make the http_server setting to be https. Along with this too:

https for OpenCart 1.5

Switch on in Settings/System/Server Check admin/config.pgp and config.php have correct SSL url set

Setting the http_server setting in config.php - usually and should be http. When set to https that seems to sort it.

So in config.php I now have

<?php
// HTTP
define('HTTP_SERVER', 'https://www.example.com/');

So now when I "view source" when the page is in http and search for any refs to http:// I get no returns.

Upvotes: 0

abdulaziz ibrahim
abdulaziz ibrahim

Reputation: 73

go to root folder click system and then go to config , highlight admin.php,and edit it...make sure site ssl is true

Upvotes: 0

Sankar V
Sankar V

Reputation: 4128

You've missed https for the admin url. Change the below values in your admin/config.php

define('HTTPS_SERVER', 'http://example.com/admin/');
define('HTTPS_CATALOG', 'http://example.com/');

to

define('HTTPS_SERVER', 'https://example.com/admin/');
define('HTTPS_CATALOG', 'https://example.com/');

Upvotes: 0

Related Questions