ISAPI重写3规则,用于将http重定向到特定站点的https

时间:2009-11-02 22:38:21

标签: iis-6 https isapi-rewrite

我在运行ISAPI Rewrite 3(免费添加)的单个IIS 6服务器上有多个站点。

如果请求以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。

2 个答案:

答案 0 :(得分:1)

规则应该如下:

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

答案 1 :(得分:0)

这看起来很容易

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