Skip to content

Instantly share code, notes, and snippets.

@EastSideCode
Last active March 13, 2019 15:27
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 EastSideCode/be3f55bb7dfd40dcd3ef6cbb0cfa4b61 to your computer and use it in GitHub Desktop.
Save EastSideCode/be3f55bb7dfd40dcd3ef6cbb0cfa4b61 to your computer and use it in GitHub Desktop.
Force HTTS and www
# force HTTPS and www.
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://www.%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