Skip to content

Instantly share code, notes, and snippets.

@dry
Created August 23, 2012 16:20
Show Gist options
  • Save dry/3438221 to your computer and use it in GitHub Desktop.
Save dry/3438221 to your computer and use it in GitHub Desktop.
Rewrite Force HTTPS
RewriteCond %{HTTPS} off
RewriteCond $1 ^(section|othersection) [NC]
RewriteRule ^(.*)$ https://domain.com/$1 [R=301,L]
RewriteCond %{HTTPS} on
RewriteCond $1 ^(anothersection|anothersection|anothersection) [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment