Created
December 8, 2018 12:24
-
-
Save ewingson/f6d3f685fda4abbdc492d5461a2a9f70 to your computer and use it in GitHub Desktop.
apache2_directory_rewrite_another_set_of_rules_that_seem_to_make_sense
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
# match any URL with www and rewrite it to https without the www | |
RewriteCond %{HTTP_HOST} ^(www\.)(.*) [NC] | |
RewriteRule (.*) https://%2%{REQUEST_URI} [R=301,L] | |
# match non https and redirect to https | |
RewriteCond %{HTTP:X-Forwarded-Proto} !https | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment