Last active
June 21, 2016 07:54
-
-
Save AD7six/5819daf9e5924a343bec to your computer and use it in GitHub Desktop.
A single redirect for your cloudflare app for http to https, and www.example.com (and olddomain.com etc.) to example.com
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
# Copy and paste into your .htaccess file or include in your apache conf files | |
RewriteCond %{HTTP:CF-Visitor} '"scheme":"http"' [OR] | |
RewriteCond %{HTTP_HOST} !^example.com$ [NC] | |
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L] | |
# And remember to always use https for future requests | |
Header set Strict-Transport-Security "max-age=16070400; includeSubDomains" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does this redirect all subdomains to https://example.com, or just www.example.com?