Skip to content

Instantly share code, notes, and snippets.

@kevinquillen
Created March 31, 2017 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevinquillen/dc694bc64c98b52daed0b8dbae1028f6 to your computer and use it in GitHub Desktop.
Save kevinquillen/dc694bc64c98b52daed0b8dbae1028f6 to your computer and use it in GitHub Desktop.
Example htaccess rule to force all traffic over HTTPS
# Force all traffic to HTTPS, except a local instance
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTP_HOST} !^mysite\.local$ [NC]
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