Created
July 26, 2018 23:04
-
-
Save ngearing/9be1dbbcdf654737b8e2cfb64b73f9d2 to your computer and use it in GitHub Desktop.
apache .htaccess https redirect
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 | |
# This will enable the Rewrite capabilities | |
RewriteOptions InheritDownBefore | |
# This prevents the rule from being overrided by .htaccess files in subdirectories. | |
RewriteCond %{HTTPS} !=on | |
# This checks to make sure the connection is not already HTTPS | |
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [QSA,R,L] | |
# This rule will redirect users from their original location, to the same location but using HTTPS. | |
# i.e. http://www.example.com/foo/ to https://www.example.com/foo/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment