Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
redirect http and www to https and non www.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://example.com/$1 [R,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment