Skip to content

Instantly share code, notes, and snippets.

@anveo
Created June 10, 2010 17:06
Show Gist options
  • Save anveo/433306 to your computer and use it in GitHub Desktop.
Save anveo/433306 to your computer and use it in GitHub Desktop.
# redirect any request to the /secure path to https
RewriteCond %{SERVER_NAME} ^www.example.com$
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} secure
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
# Redirect any pages not in the secure or image folder back to http
RewriteCond %{SERVER_PORT} 443
RewriteCond %{REQUEST_URI} !secure
RewriteCond %{REQUEST_URI} !images
RewriteRule ^(.*)$ http://www.example.com/$1 [R,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment