Skip to content

Instantly share code, notes, and snippets.

@arthurattwell
Created June 18, 2018 14:24
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 arthurattwell/6cf506dacae782a04d3010220fbfba26 to your computer and use it in GitHub Desktop.
Save arthurattwell/6cf506dacae782a04d3010220fbfba26 to your computer and use it in GitHub Desktop.
Send all traffic to non-www https
# Send www to non-www (thanks http://stackoverflow.com/questions/234723/generic-htaccess-redirect-www-to-non-www)
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment