Skip to content

Instantly share code, notes, and snippets.

@paxperscientiam
Created April 4, 2018 21:05
Show Gist options
  • Save paxperscientiam/6a08131955d0b806e78f8b2bfbd2c7b4 to your computer and use it in GitHub Desktop.
Save paxperscientiam/6a08131955d0b806e78f8b2bfbd2c7b4 to your computer and use it in GitHub Desktop.
Using SSL in production only (set conditional)
# This assumes a, say, virtualhost on your dev machine like the following:
# <Virtualhost *:80>
# # ...
# SetEnv APPLICATION_ENV "development"
# # ...
# </Virtualhost>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{ENV:APPLICATION_ENV} !^development$
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment