ISAPI 重写 - 同一 Web 服务器上的多个站点

发布于 2024-11-13 10:40:57 字数 225 浏览 6 评论 0原文

我很难找到有关为一台 Web 服务器上的多个站点设置 ISAPI_Rewrite 规则的清晰/简洁的文档。我们需要每个站点都有自己的 httpd.ini 文件,概述自己的规则集。此外,每个站点可能使用不同版本的 ISAPI_Rewrite 模块(必须考虑到这一点)。我们使用的是 IIS 6.0。

有人对如何做到这一点有任何建议吗?

任何帮助将不胜感激!

谢谢,

-汤姆

I'm having difficulties finding clear/concise documentation on setting up ISAPI_Rewrite rules for multiple sites living on one web server. We need each site to have its own httpd.ini file outlining its own rule set. Additionally, each site may be using different versions of the ISAPI_Rewrite module (this must be taken into consideration). We are using IIS 6.0.

Does anyone have any suggestions on how to go about doing this?

Any help would be greatly appreciated!

Thanks,

-Tom

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

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

发布评论

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

评论(1

初见 2024-11-20 10:40:57

既然你提到了 httpd.ini,我猜你正在使用 isapi_rewrite v2。我建议在 IIS 6 上升级到 v3(对于 IIS 7 机器,helicon 强烈推荐“Ape”,我没有尝试过。)

这假设 isapi_rewrite v3 的付费版本;免费软件精简版不适用于此答案。

在 v3 中,该文件被命名为 .htaccess 而不是 httpd.ini

每个网站都可以有自己的 .htaccess 文件,具有独立的规则。将每个文件放置在每个网站的根文件夹中。

对于不同版本的模块,我没有尝试保留安装的两个版本,并且不确定是否可能。相反,v3 有一个 RewriteCompatibility2 指令,您可以在每个 .htaccess 文件中包含或省略该指令。这应该允许您在某些网站上使用 v2 规则,而在其他网站上使用 v3 规则。

显然这使得 v3 与 v2 兼容,但不是 100% 语法匹配。它们为现有规则提供翻译工具。我似乎记得它几乎没有改变任何东西。主要区别在于查询字符串参数处理 - 它在 v2 规则中是明确的,但在 v3 中单独处理。 (一旦完全转换为 v3,规则就简单得多。)

以上应该可以解决您的问题,但还有更复杂的配置:

子目录也可以有自己的 .htaccess 文件,这些文件在父文件之后运行。我已经这样做过一次来处理指向“当前”数据文件夹。

还有针对 VirtualHost、Directory、Location、Files 的指令。
此处概述:http://www.helicontech.com/isapi_rewrite/doc/context.htm< /a>.我不得不读几次这篇文章,因此请阅读各个指令以获得稍微更清晰的解释。

Since you mention httpd.ini, I'm guessing you're using isapi_rewrite v2. I suggest upgrading to v3 on IIS 6 (For IIS 7 machines, helicon is strongly recommending 'Ape' which I have not tried.)

This assumes the paid version of isapi_rewrite v3; the freeware Lite version will not work for this answer.

In v3, the file is named .htaccess instead of httpd.ini

Each website can have its own .htaccess file, with independent rules. Place each file in each website's root folder.

For different versions of the module, I haven't tried keeping two versions installed, and am not sure it's possible. Instead v3 has a RewriteCompatibility2 directive, that you can include or omit in each .htaccess file. This should let you use v2 rules on some websites, while using v3 rules on other sites.

Apparently this makes v3 compatible with v2, but not 100% a syntax match. They provide a translation tool for existing rules. I seem to recall it barely changed anything. The main difference is query string parameter handling - it's explicit in the v2 rules, but handled separately in v3. (Once fully converted to v3, the rules are much much simpler.)

The above should solve your problems, but there are more complex configurations also:

Subdirectories can also have their own .htaccess files, which are run after the parent file. I've done this once to handle pointing a 'current' data folder.

There are also directives for VirtualHost, Directory, Location, Files.
Overview here: http://www.helicontech.com/isapi_rewrite/doc/context.htm. I had to read this a few times, so read the individual directives for a slightly clearer explanations.

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