ISAPI Rewrite 3 rule for redirectling http to https for a particular site
I have multiple sites on a single IIS 6 server running ISAPI Rewrite 3 (free additi开发者_如何学Pythonon).
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.
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]
That looks like an easy thing to do
RewriteEngine on
RewriteRule http://bar.foo.com https://bar.foo.com [NC]
精彩评论