Skip to content

Instantly share code, notes, and snippets.

@mrpatg
Created April 5, 2019 00:35
Show Gist options
  • Save mrpatg/9b40e7a62b1ae847cb0c44915099d0e1 to your computer and use it in GitHub Desktop.
Save mrpatg/9b40e7a62b1ae847cb0c44915099d0e1 to your computer and use it in GitHub Desktop.
.htaccess force https
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment