Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@DrewDouglass
Created December 22, 2016 15:36
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 DrewDouglass/3db9b8413ef35dd5d23a3d0217dc1d14 to your computer and use it in GitHub Desktop.
Save DrewDouglass/3db9b8413ef35dd5d23a3d0217dc1d14 to your computer and use it in GitHub Desktop.
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