For me, this has always been frustrating because I use it only once every 8-12 months. Here are some great links to get refreshed.
Basically, what I was trying to do was get all traffic https going to my customers’ mywebsite.com/payments page and all other traffic without “/payments” in the name to mymainwebsite.com. It is important to note, that the myshorturl.ca site is the one with the https or SSL on it. Here are the links I used
- http://httpd.apache.org/docs/current/mod/mod_rewrite.html
- http://www.askapache.com/htaccess/http-https-rewriterule-redirect.html
- http://serverfault.com/questions/214512/redirect-change-urls-or-redirect-http-to-https-in-apache-everything-you-ever
The eventual code form my .htaccess file was
[php]
#RewriteCond {HTTPS} on
#RewriteRule ^(.*)$ https://www.myshorturl.ca/payments/$1
#RewriteCond %{HTTPS} on
#RewriteRule .* https://www.myshorturl.ca/payments [R,L]
RewriteCond %{REQUEST_URI} /tithe [NC]
RewriteRule ^(.*)$ https://www.myshorturl.ca/payments/ [L,R=301]
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} /payments [NC]
RewriteRule ^(.*)$ https://www.mycumbersomeurl.ca/payments/$1 [L,R=301]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^www.mycumbersomeurl.com$ [NC]
RewriteRule ^(.*)$ http://www.mycumbersomeurl.com/$1 [L,R=301]
[/php]