Created
June 24, 2019 23:21
-
-
Save amsgator/49a42a93251080888e8930eb9439f097 to your computer and use it in GitHub Desktop.
Redirect all traffic to naked https in 1 hop
This file contains 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
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
# Redirect all http to naked https in 1 hop | |
RewriteCond %{HTTPS} !on [NC] | |
RewriteRule ^(.*)$ https://domain\.com/$1 [R=301,L] | |
# Redirect all https www to naked https in 1 hop | |
RewriteCond %{HTTP_HOST} ^www\.domain\.com [NC] | |
RewriteRule ^(.*)$ https://domain\.com/$1 [R=301,L] | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment