Last active
July 5, 2021 23:33
-
-
Save geminorum/3f4d2f464a8b603beacb81354b742e98 to your computer and use it in GitHub Desktop.
Force SSL
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
# OLD: https://www.janes.co.za/quick-tip-force-ssl-with-htaccess/ | |
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
RewriteCond %{HTTPS} !=on [NC] | |
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/ | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] | |
</IfModule> | |
# BEGIN Redirect HTTP to HTTPS | |
# https://www.wpfastestcache.com/tutorial/how-to-redirect-all-http-to-https-htaccess/ | |
RewriteEngine On | |
RewriteCond %{HTTPS} !on | |
RewriteCond %{SERVER_PORT} !^443$ | |
RewriteCond %{HTTP:X-Forwarded-Proto} !https | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] | |
# END Redirect HTTP to HTTPS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment