Skip to content

Instantly share code, notes, and snippets.

@tjsudarsan
Created September 22, 2018 05:37
Show Gist options
  • Save tjsudarsan/d365c6f2ef11e0b9e5b446362617e00a to your computer and use it in GitHub Desktop.
Save tjsudarsan/d365c6f2ef11e0b9e5b446362617e00a to your computer and use it in GitHub Desktop.
RewriteEngine On
RewriteCond %{HTTPS} !^on$
RewriteRule (.*) https://www.example.com/$1 [R,L]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment