Created
April 7, 2019 09:59
-
-
Save egulhan/1d8752498a18db07884d4f389c1a76ff to your computer and use it in GitHub Desktop.
use these force HTTPS apache directives (in .htaccess) if you have proxied server (such CloudFlare) or you are using a shared hosting
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
RewriteEngine On | |
# If we receive a forwarded http request from a proxy... | |
RewriteCond %{HTTP:X-Forwarded-Proto} =http [OR] | |
# ...or just a plain old http request directly from the client | |
RewriteCond %{HTTP:X-Forwarded-Proto} ="" | |
RewriteCond %{HTTPS} !=on | |
# Redirect to https version | |
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment