I'm trying to automatically redirect for any url that has "checkout" in it to https. Otherwise, if the url is https but doesn't have "checkout", I want to redirect to "http:". Only urls with "checkout" can have https. I need an if-then-else structure. The syntax below doesn't work ... redirects to index.php if there is https in the url.
RewriteEngine On
RewriteCond %{HTTPS} !^on$
RewriteRule (checkout.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
RewriteCond %{HTTPS} !^off$
RewriteRule !(checkout.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [R,L]
RewriteRule !\.(js|ico|gif|jpg|png|css|swf|xml|avi|flv|mov|mp3|wav)$ index.php [L]