Skip to content

Instantly share code, notes, and snippets.

@typhonius
Created December 18, 2014 03:28
Show Gist options
  • Save typhonius/aba8c60198254a3db0c7 to your computer and use it in GitHub Desktop.
Save typhonius/aba8c60198254a3db0c7 to your computer and use it in GitHub Desktop.
diff --git a/.htaccess b/.htaccess
index 7ccb6a2..fa16812 100644
--- a/.htaccess
+++ b/.htaccess
@@ -56,6 +56,13 @@ DirectoryIndex index.php index.html index.htm
<IfModule mod_rewrite.c>
RewriteEngine on
+ # Redirect HTTP to HTTPS on Acquia hosted sites.
+ RewriteCond %{HTTPS} off
+ RewriteCond %{HTTP:X-Forwarded-Proto} !https
+ RewriteCond %{ENV:AH_SITE_ENVIRONMENT} 01test [OR]
+ RewriteCond %{ENV:AH_SITE_ENVIRONMENT} 01live
+ RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
+
# Set "protossl" to "s" if we were accessed via https://. This is used later
# if you enable "www." stripping or enforcement, in order to ensure that
# you don't bounce between http and https.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment