Skip to content

Instantly share code, notes, and snippets.

Created July 27, 2020 15:31
What would you like to do?
Redirect to non-www and https in one step with Apache
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP:X-Forwarded-Proto} !https [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule (.*)$1 [L,R=301]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment