News and articles
A selection of new modules for Opencart in November 2024

New products for November 2024: SDEK, Sberbank Installment Plan, Simple Reviews.

 
 
 
 
 
Transferring purchases from one account to anothe

How to transfer module and template purchases from one account to another.

 
 
 
 
 
Best-selling templates and extensions in November 2024

Best-selling templates and extensions in November 2024: Dream Filter, Microdata, Frame template

 
 
 
 
 
OpenCart setup for HTTPS

This article covers the key steps for configuring OpenCart to work over HTTPS, including redirection, configuration changes, and accounting for SEO aspects.

 
 
 
 
 
How to disable advertising banners in the admin panel of OpenCart 3

The modifier for OpenCart 3 disables advertising banners in the admin panel, addressing performance and module display issues.

 
 
 
 
 

OpenCart setup for HTTPS

 
OpenCart setup for HTTPS
  • 0

Transitioning to the HTTPS protocol is not only an important step for improving site security but also a mandatory requirement of modern search engines. This article covers the key steps for configuring OpenCart to work over HTTPS, including redirection, configuration changes, and accounting for SEO aspects.

Before configuring the site to work with HTTPS, you need to purchase or install an SSL certificate. The certificate encrypts data between the server and users, ensuring a secure connection. For small sites or projects, a free SSL certificate such as from Let's Encrypt, which is supported by most hosting providers, will be sufficient. It can be installed through the hosting control panel or with the help of specialized tools.

1. Configuring OpenCart for HTTPS

Enabling HTTPS in Store Settings

Go to the OpenCart admin panel:

  • Go to System > Settings > Edit Store.
  • In the "Server" tab, select "Yes" for "Use SSL."
  • Make sure the HTTPS certificate is installed on the server.

Changing Configuration Files

Change in /config.php at the root of the site from HTTP to HTTPS:

Was:

define('HTTP_SERVER', 'http://liveopencart.ru/');
define('HTTPS_SERVER', 'https://liveopencart.ru/');

Now:

define('HTTP_SERVER', 'https://liveopencart.ru/');
define('HTTPS_SERVER', 'https://liveopencart.ru/');

Change in /admin/config.php from HTTP to HTTPS:

Was:

// HTTP
define('HTTP_SERVER', 'http://liveopencart.ru/admin/');
define('HTTP_CATALOG', 'http://liveopencart.ru/');

// HTTPS
define('HTTPS_SERVER', 'https://liveopencart.ru/admin/');
define('HTTPS_CATALOG', 'https://liveopencart.ru/');

Now:

// HTTP
define('HTTP_SERVER', 'https://liveopencart.ru/admin/');
define('HTTP_CATALOG', 'https://liveopencart.ru/');

// HTTPS
define('HTTPS_SERVER', 'https://liveopencart.ru/admin/');
define('HTTPS_CATALOG', 'https://liveopencart.ru/');

2. Configuring robots.txt for HTTPS

Make sure the file robots.txt contains the correct rules:

Sitemap: https://liveopencart.ru/sitemap.xml

3. Configuring Redirection from HTTP to HTTPS

Add the following code to the .htaccess file:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

TimeWeb hosting recommends the following code:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP:X-HTTPS} !1
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

Beget hosting recommends the following code:

RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !=https
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]

Please note that the redirection setup depends on many factors, and the provided options may not work correctly for you.

4. Redirecting from www to non-www (if necessary)

From www to non-www

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

TimeWeb hosting recommends the following code:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.forum\.example\.ru$ [NC]
RewriteRule ^(.*)$ http://forum.example.ru/$1 [R=301,L]

From non-www to www

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]

TimeWeb hosting recommends the following code:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^forum\.example\.ru$ [NC]
RewriteRule ^(.*)$ http://www.forum.example.ru/$1 [R=301,L]

Please note that the redirection setup depends on many factors, and the provided options may not work correctly for you.

5. Smooth Transition to HTTPS

  • Set up a 301 redirect to notify search engines of the address change.
  • Keep the old sitemap until the new addresses are indexed. We have a separate article on sitemap modules.
  • Submit the updated sitemap with HTTPS links to search engines.

6. Configuring Webmasters in Yandex

Yandex.Webmaster - more details here.

The robot will learn about the protocol change during its next visit to the site. To speed up the change process, add both versions of the site (HTTP and HTTPS) in Webmaster and notify about the move using the Site Move tool:

  • Go to Webmaster and select the site you want to migrate.
  • On the Indexing > Site Move page, enable the Add HTTPS option. Click Save.

7. Replacing Old HTTP Links in Articles, Product Descriptions, and Scripts

In the Database

Run SQL queries via phpMyAdmin or another database editor to replace the links. Don’t forget to make a backup of the database before making any changes.

UPDATE oc_product_description SET description = REPLACE(description, 'http://', 'https://');
UPDATE oc_information_description SET description = REPLACE(description, 'http://', 'https://');
UPDATE oc_category_description SET description = REPLACE(description, 'http://', 'https://');

In Template Files

Check template files like header.twig, header.tpl, footer.twig, and footer.tpl to ensure all links are using HTTPS.

8. Checking External Links

External links can be found using the following tools:

  • Google Search Console: under Links > External Links > Pages, you can track links, find redirected links, and identify the most frequently referenced pages and resources.
  • Yandex.Webmaster: under Links > External Links, all backlinks are displayed. You can check their indexing status.

Рекомендуем прочитать
 
 


Yet, no one has left a comment to the entry.