Skip to content

Instantly share code, notes, and snippets.

@corysolovewicz
Created July 31, 2019 21:35
Show Gist options
  • Save corysolovewicz/86f8693220828312d061e145cf95df64 to your computer and use it in GitHub Desktop.
Save corysolovewicz/86f8693220828312d061e145cf95df64 to your computer and use it in GitHub Desktop.
Conditional SSL using mod_rewrite in Apache
# http://phpstarter.net/2008/07/several-htaccess-mod_rewrite-tricks-to-better-web-application/
# any access to "secure" directory is redirected to HTTPS
RewriteCond %{HTTPS} off
RewriteRule ^secure/.*$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment