Redirect from http to https for OkayCMS

Categories

Recently, the popularity of the https protocol has grown very much, as it has a very good effect on the site's reputation "in the eyes of a search robot.

That is why we are posting for free access several ways to redirect from http to https for OkayCMS.

We make edits to the .htaccess file, put the following redirects in front of the redirect to the admin panel

Attention! On some hosting, the methods may differ, I will give a few, in order of popularity.

Method 1. Works exactly on 60% hosting (ukraine.com.ua and Timeweb are verified)

 RewriteBase /
RewriteCond% {HTTP: SSL}! = 1 [NC]
RewriteRule ^ (. *) Https://new_domain.com/$1 [L, R = 301]

Method 2.

 RewriteEngine On
RewriteCond% {HTTPS} off
RewriteCond% {HTTP: X-Forwarded-Proto}! Https
RewriteRule ^ (. *) $ Https: //% {HTTP_HOST}% {REQUEST_URI} [L, R = 301]

Method 3. (off. Information from hosting REG.RU)

 RewriteEngine On
RewriteCond% {HTTPS} = on
RewriteRule (. *) Https: //% {HTTP_HOST}% {REQUEST_URI} [QSA, L]
Comments 2
MefLemberg
17.11.2021, 22:03
Також Fornex, версія 4.2.0.
Варіант #2 - не працює (кидає в 500-ту)

Рішення:

RewriteEngine on

RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTP:X-Forwarded-Proto} =http [OR]
RewriteCond %{HTTP:X-Forwarded-Proto} =""
RewriteCond %{HTTP:X-HTTPS} !1 [OR]
RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} !robots\.txt
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

#RewriteBase /
OkayCMS
17.11.2021, 22:05
MefLemberg, спасибо за ещё один вариант решения проблемы
Влад
28.09.2017, 19:16
У меня на Fornex заработал второй способ.
Write your comment
log in
Download OkayCMS
version 4.2.1
Subscribe to the newsletter
You will receive a selection of useful articles on working with the site on OkayCMS, discounts on modules and templates