Skip to content

Instantly share code, notes, and snippets.

@royce002
Created June 3, 2022 15:29
Show Gist options
  • Save royce002/d05d0cf21654563d882df140b77d7d77 to your computer and use it in GitHub Desktop.
Save royce002/d05d0cf21654563d882df140b77d7d77 to your computer and use it in GitHub Desktop.
Redirect to https and non-www .htaccess
# Canonical HTTPS/non-WWW
<IfModule mod_rewrite.c>
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule (.*) https://example.com/$1 [L,R=301]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment