Skip to content

Instantly share code, notes, and snippets.

@ixkaito
Created April 27, 2019 10:26
Show Gist options
  • Save ixkaito/133c1640e9a512ae02475771e7597c11 to your computer and use it in GitHub Desktop.
Save ixkaito/133c1640e9a512ae02475771e7597c11 to your computer and use it in GitHub Desktop.
Redirect www to non-www and HTTP to HTTPS
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment