Last active
November 5, 2016 08:33
-
-
Save edalis/c2a6331dd7a6d9d88ae264f4eba00e92 to your computer and use it in GitHub Desktop.
Redirect http:// to https://, http://www to https://
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
## https://www.reg.ru/support/hosting-i-servery/sajty-i-domeny/kak-dobavit-redirekt/redirekt-s-http-na-https | |
## вариант 1 | |
RewriteEngine On | |
RewriteCond %{HTTPS} =on | |
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [QSA,L] | |
## вариант 2 | |
RewriteEngine On | |
RewriteCond %{SERVER_PORT} !^443$ | |
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L] | |
## вариант 3 | |
RewriteEngine On | |
RewriteCond %{HTTPS} off | |
RewriteCond %{HTTP:X-Forwarded-Proto} !https | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
################################################################ | |
## https://toster.ru/q/174797 | |
RewriteCond %{ENV:HTTPS} !on | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
################################################################ | |
## https://bjoernfranzen.com/how-to-set-up-a-letsencrypt-ssl-certificate-for-your-wordpress-website-on-a-digital-ocean-server-managed-with-a-serverpilot-free-account/ | |
RewriteCond %{HTTP:X-Forwarded-Proto} !=https | |
RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=302,L] | |
################################################################ | |
# BEGIN rlrssslReallySimpleSSL rsssl_version[2.3.14] | |
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
RewriteCond %{HTTP:X-Forwarded-Proto} !https | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] | |
</IfModule> | |
# END rlrssslReallySimpleSSL | |
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
//Begin Really Simple SSL Load balancing fix | |
if (isset($_SERVER["HTTP_X_FORWARDED_PROTO"] ) && "https" == $_SERVER["HTTP_X_FORWARDED_PROTO"] ) { | |
$_SERVER["HTTPS"] = "on"; | |
} | |
//END Really Simple SSL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment