Created
September 18, 2012 17:46
-
-
Save willmcclellan/3744583 to your computer and use it in GitHub Desktop.
https to http and vice versa .htaccess
This file contains hidden or 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
# Enable Rewrite Engine | |
RewriteEngine On | |
RewriteBase / | |
# http: rewrite rule to secure sections (redirect to https) | |
RewriteCond %{HTTPS} off | |
RewriteCond %{REQUEST_URI} ^(/directoryA(.*)$|/directoryB(.*)$)$ | |
RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI} [L,R] | |
# http: rewrite rule for other pages (redirect to http) | |
RewriteCond %{HTTPS} on | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_URI} !^/directoryA(.*)$ | |
RewriteCond %{REQUEST_URI} !^/directoryB(.*)$ | |
RewriteRule (.*) http://%{SERVER_NAME}%{REQUEST_URI} [L,R] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment