Skip to content

Instantly share code, notes, and snippets.

@dtolj
Created September 3, 2009 15:03
Show Gist options
  • Save dtolj/180346 to your computer and use it in GitHub Desktop.
Save dtolj/180346 to your computer and use it in GitHub Desktop.
redirect to https for login pages only
#Redirect HTTPS to HTTP
Options +FollowSymlinks
RewriteCond %{SERVER_PORT} ^443$
#select any url excluding the one containing login
RewriteRule (?!login\b)\b\w+\W+ http://%{HTTP_HOST}%{REQUEST_URI} [R,L]
#Redirect HTTP to HTTPS
Options +FollowSymlinks
RewriteCond %{HTTPS} off
RewriteRule ^(.*)login/$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment