Created
March 4, 2021 22:14
-
-
Save royce002/dcba7d5ae41b4afb29e300aa5bd28205 to your computer and use it in GitHub Desktop.
.htaccess script to redirect all traffic to https with no wwws.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Redirect to https and non-www | |
# 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