2009-11-02 102 views
1

我在运行ISAPI重写3(免费添加)的单个IIS 6服务器上有多个站点。ISAPI重写3规则将http重定向到特定站点的https

如果请求以http的形式出现,我需要将其中一个站点重定向到https。

例如:我需要http://bar.foo.com重定向到https://bar.foo.com。我不希望此重定向影响http://www.foo.comhttp://foo.comhttp://meh.foo.com

这个问题的重定向语法是什么?

我找到了http://www.helicontech.com/isapi_rewrite/doc/examples.htm,它显示了如何将所有请求重定向到https。

回答

0

这看起来像一个容易的事

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

的规则应该是这样的:

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