Skip to content

Instantly share code, notes, and snippets.

@meaku
Created March 18, 2013 13:14
Show Gist options
  • Save meaku/5187056 to your computer and use it in GitHub Desktop.
Save meaku/5187056 to your computer and use it in GitHub Desktop.
.htaccess for SSL via SNI to prevent the certificate-error for unsupported browsers. Always share http links and https will be used if supported. Otherwise the connection will be http. SNI is not supported on IE on Windows XP (5 - 8) and Android < 4.x __Important Note__ Don't use this .htaccess if you need HTTPS for all your clients. It is just …
# HTTP(S) Stuff
# Redirect all users except IE 5-8 & Android < 4 to HTTPS
RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{HTTP_USER_AGENT} !MSIE\ [5-8]
RewriteCond %{HTTP_USER_AGENT} !Android.*(Mobile)?\ [0-3]
RewriteRule (.*) https://%{HTTP_HOST}/$1 [L]
@JDW1
Copy link

JDW1 commented Jan 27, 2017

y59, not everyone has access to the server config file, but many do have edit power over .htaccess. Therefore, how would you reformat your suggested code for use in .htaccess?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment