Skip to content

Instantly share code, notes, and snippets.

@eliandoran
Created March 17, 2017 05:30
Show Gist options
  • Save eliandoran/e7ce39f7750463475389bafbbefaef67 to your computer and use it in GitHub Desktop.
Save eliandoran/e7ce39f7750463475389bafbbefaef67 to your computer and use it in GitHub Desktop.
Redirect traffic from HTTP to HTTPS
# BEGIN Redirection to HTTPS
<IfModule mod_rewrite.c>
RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
# END Redirection to HTTPS
@eliandoran
Copy link
Author

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