Ssl – Conditional https redirect to http depending on URL? (Apache)

apache-2.2httpsredirectssl

Right now I redirect 100% of the time if someone does https://mysite.com

<VirtualHost *:443>
   ServerAdmin webmaster@mysite.com
   ServerName mysite.com
   ServerAlias www.mysite.com

   RewriteEngine on
   RewriteRule (.*) http://%{HTTP_HOST} [L,R=permanent]
<VirtualHost>

However, now I want to conditionally redirect. If a user goes to https://mysite.com/abc/, then I want to use https; otherwise redirect.

How do I do this? I tried reading the docs, but just couldn't find what I needed.

I am using Apache on Ubuntu Linux.

Best Answer

Try adding a RewriteCond (Rewrite Condition) before the RewriteRule. I would try writing something like this:

RewriteCond %{REQUEST_URI} !^.*(abc).*$ [NC]

Here is some additional reading if this doesn't help:
- http://www.whoopis.com/howtos/apache-rewrite.html
- http://www.sitepoint.com/article/apache-mod_rewrite-examples/