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

Posted by Joel Marcey on Server Fault See other posts from Server Fault or by Joel Marcey
Published on 2009-08-28T22:33:32Z Indexed on 2010/03/30 4:23 UTC
Read the original article Hit count: 212

Filed under:
|
|
|

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

<VirtualHost *:443>
   ServerAdmin [email protected]
   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.

© Server Fault or respective owner

Related posts about apache

Related posts about redirect