Участник
Пользователь
- Сообщения
- 270
- Реакции
- 43
- Помог
- 5 раз(а)
hello, all. I have a problem with .htaccess maybe someone will help "http not redirecting to https" how to properly configure?
Код:
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 ^(.*)$ 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]
В этой теме было размещено решение! Перейти к решению.