Peter Jack
Peter Jack

Reputation: 867

Opencart 2.2.x ssl for all request

i install opencart lastest version and i wanna enable all ssl for url

In admin set SSL enable

in config.php both admin and category change to https

htaccess

RewriteEngine On
RewriteBase /

RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^system/download/(.*) index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

but when url is not SEO it work so url with SEO it not work the url will be https://www.localhost/index.php?route=desktops/mac

how to change to https://www.localhost/desktops/mac

Upvotes: 4

Views: 9871

Answers (5)

keith
keith

Reputation: 1

Ok, here's what I just did: https was showing errors and my add to cart, etc - was not working. I had to enable ssl in the site settings from admin, standard, then I checked my header.tpl file in notepad and clicked on edit-find HTTP and changed two entries to HTTPS

<meta https-equiv="X-UA-Compatible" content="IE=edge">

and the dir to an image file I had added in the html for the header at an earlier date, which directed it to http://mywebsite url.

These two things were causing the error. As soon as I ftp'd the file back to the site it worked fine in Firefox and IE. I'm a complete novice at coding but it was obvious (after ripping a few hairs out) so just check your header files and change every http to https. And cross your fingers and toes.

Upvotes: 0

user2986055
user2986055

Reputation:

I also installed opencart 2.2.

I tried the extension for https but it crashed everything ;(

I found a working solution 3 Steps :

•• 1 •• in .htaccess : Added at the end

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteCond %{REQUEST_URI} store 
RewriteRule ^(.*)$ https://www.__your_domain__.com/store/$1 [R,L]

•• 2 ••
in config.php in root + admin

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

// HTTPS
define('HTTPS_SERVER', 'https://www.__your_domain__.com/store/');

**** even with https:// in the browser wasn't enough.... in the source every links where http:// .... **** So i found this last step


•• 3 •• in system/library/url Modified http to https and voilà :)

public function link($route, $args = '', $secure = false) {
        if ($this->ssl && $secure) {
            $url = 'https://' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['SCRIPT_NAME']), '/.\\') . '/index.php?route=' . $route;
        } else {
            $url = 'https://' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['SCRIPT_NAME']), '/.\\') . '/index.php?route=' . $route;
        }

Upvotes: 4

zoro zoro
zoro zoro

Reputation: 11

It means that install the opencart whitout vqmod and use the solution and then install vqmod

Upvotes: -1

integris
integris

Reputation: 188

I just spent and entire night getting this to work hope it helps somebody. I currently have an Opencart 2.2 with SSL/https working for all pages. (good crap what a chore).. I am using the Fastor Theme and have SEO Pack Pro, vQMOD, and several other mods and extensions.

Here's what I did: 1. Install v2.2.0.x Changes.zip DO NOT update VQMOD to 2.6.1 (killed my install) DO NOT install VQMOD Manager 3.0 (Also killed my install). Just Manually install. Google that if you need to.

  1. Then install this extension No I can't read spanish, but I looked at the xml file and it's setting site_ssl to true in multiple pages as was suggested to do manually somewhere deep in the forums. This made it so the checkout/checkout and information pages also worked.

  2. Admin panel > Settings > Security > Use SSL

  3. Modify .haccess for SEO/SSL/WWW (I got my cert for www of the site because I wanted the whole site to be SSL). Replaces the seo rewrite chunk you should see in your haccess file:

Blockquote

#SEO URL Settings
RewriteEngine On
#If your opencart installation does not run on the main web folder make    sure you folder it does run in ie. / becomes /shop/

RewriteBase /

RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^system/download/(.*) index.php?route=error/not_found [L]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=302]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [QSA]
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R=302,L]
  1. Modify config.php and admin/config.php. Make all http -> https

Blockquote

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

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

admin/config.php

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

// HTTPS
define('HTTPS_SERVER', 'https://www.example.com/admin/');
define('HTTPS_CATALOG', 'https://www.example.com/');
  1. Clear your mod cache and browser cache/temp files before testing.

Other Manual Fixes I made: Currency/Currency Fix The currency/currency "fix" didn't work for me. If the currency changer is breaking your SSL you can try that fix or remove it by removing all code in view/common/currency.tpl. Make a backup and then just blank the code.

Not Loading Images/CSS Try this fix: I also put in this fix by hand don't know if the v2.2.0 Changes.zip gets this one or not:

Blockquote

SEO/SSL cant load page

Open catalog/controller/startup/startup.php

and after

$this->config->set('config_url', HTTP_SERVER);

add

$this->config->set('config_ssl', HTTPS_SERVER);

Upvotes: 3

Pranav Bhatt
Pranav Bhatt

Reputation: 745

Have you changed in admin ? in admin panel > setting > security enable use SSL

Upvotes: 1

Related Questions