Created
January 10, 2017 19:35
-
-
Save orlov0562/08cdb846ffcd2aeebb8e99bc41e59b01 to your computer and use it in GitHub Desktop.
Revisions
-
orlov0562 created this gist
Jan 10, 2017 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / # Redirect old browsers to upgrade page, to support SNI for https SetEnv SSL_TLS_SNI %{SSL:SSL_TLS_SNI} RewriteCond %{HTTP_USER_AGENT} MSIE\s[1-8]\. [NC,OR] RewriteCond %{HTTP_USER_AGENT} Windows\sNT\s5 [NC,OR] RewriteCond %{HTTP_USER_AGENT} Opera/[1-3]\. [NC,OR] RewriteCond %{HTTP_USER_AGENT} Safari/[1-4]\. [NC,OR] RewriteCond %{HTTP_USER_AGENT} Navigator/ [NC,OR] RewriteCond %{HTTP_USER_AGENT} Android.*(Mobile)?\ [0-3]\. [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^(.*.symbian.*) [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^(.*.blackberry.*) [NC] RewriteCond %{SSL:SSL_TLS_SNI} ="" RewriteRule .? upgrade.html [L] # If request is coming not through https, than redirect it to https # Don't put www. here. If it is already there it will be included, if not # the subsequent rule will catch it. RewriteCond %{HTTPS} off RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] # Now, rewrite any request to the wrong domain to use www. RewriteCond %{HTTP_HOST} !^www\. RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] </IfModule>