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

发布于 2024-08-10 09:15:08 字数 515 浏览 5 评论 0原文

我在运行 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< /a> 显示如何将所有请求重定向到 https。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

稚然 2024-08-17 09:15:08

规则应该如下所示:

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

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]
々眼睛长脚气 2024-08-17 09:15:08

这看起来是一件容易做的事

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

That looks like an easy thing to do

RewriteEngine on
RewriteRule http://bar.foo.com https://bar.foo.com [NC]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文