help with configuration .htaccess properly in gamecms

ptaha525

Участник
Сообщения
23
Реакции
5
Баллы
3
hello, all. The problem is http not redirecting to https
Код:
http://www.site.net > https://site.net ok
www.site.net > https://site.net ok
https://www.site.net > https://site.net ok
https://site.net > https://site.net ok
http://site.net > http://site.net problem
I want that redirect http://site.net > https://site.net

Код:
 AddDefaultCharset utf-8

RewriteBase /
Options All
Options -Indexes
Options +FollowSymLinks

RewriteEngine on

# Redirect from http to https:
# Option 1:
#RewriteCond %{SERVER_PORT} !^443$
#RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
# Option 2:
#RewriteCond %{HTTPS} =off
#RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [QSA,L]
# Option 3:
#RewriteCond %{HTTPS} off
#RewriteCond %{HTTP:X-Forwarded-Proto} !https
#RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Option 4:
#RewriteCond %{ENV:HTTPS} !on
#RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

#RewriteCond %{HTTP_HOST} ^www.site\.lt [NC]
#RewriteRule ^(.*)$ http://site.lt/$1 [R=301,L]

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

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

# Routing:
# Option 1:
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
# Option 2:
#RewriteRule ^(.*)$ /index.php?/$1 [L,QSA]
 
Последнее редактирование:
Делать редирект через htaccess - плохое решение. Этим должен заниматься веб-сервер.
 
ptaha525,
Код:
server {
    listen 80;
    server_name site.ru;
    return 301 https://site.ru$request_uri;
}
 
Назад
Сверху