Created
March 21, 2019 13:53
-
-
Save yuriy-yarvinen/647042d62bbc841db18c88b0c4a0de3b to your computer and use it in GitHub Desktop.
redirect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Редирект всех страниц с http:// на https://, в том числе и с http://www на https:// | |
Вариант 1 | |
RewriteEngine On | |
RewriteCond %{SERVER_PORT} !^443$ | |
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L] | |
или, если первый вариант не поможет, воспользуйтесь вторым вариантом: | |
Вариант 2 | |
RewriteEngine On | |
RewriteCond %{HTTPS} =off | |
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [QSA,L] | |
если все варианты не помогли и возникает циклическая переадресация: | |
Вариант 3 | |
RewriteEngine On | |
RewriteCond %{HTTPS} off | |
RewriteCond %{HTTP:X-Forwarded-Proto} !https | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
Вариант 4 | |
RewriteEngine On | |
RewriteCond %{ENV:HTTPS} !on | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment