views:

366

answers:

2

I have multiple sites on a single IIS 6 server running ISAPI Rewrite 3 (free addition).

I need to redirect just one of the sites to https if the request comes in as http.

Example: I need http://bar.foo.com to redirect to https://bar.foo.com . I don't want this redirect to affect http://www.foo.com or http://foo.com or http://meh.foo.com.

What is the redirect syntax for this problem?

I found http://www.helicontech.com/isapi_rewrite/doc/examples.htm which shows how to redirect all requests to https.

A: 

That looks like an easy thing to do

RewriteEngine on
RewriteRule http://bar.foo.com https://bar.foo.com [NC]
McLovin
A: 

The rules should look like:

RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^bar\.foo\.com$ [NC]
RewriteRule .? https://bar.foo.com%{REQUEST_URI} [R=301,L]
TonyCool