Skip to content

Instantly share code, notes, and snippets.

@bukowa
Created July 12, 2019 17:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bukowa/62fc34c20c3ea483b05bc72184160d4d to your computer and use it in GitHub Desktop.
Save bukowa/62fc34c20c3ea483b05bc72184160d4d to your computer and use it in GitHub Desktop.
www/http -> https htaccess rewrite
# https://simonecarletti.com/blog/2016/08/redirect-domain-http-https-www-apache/
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%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