【发布时间】:2023-03-25 12:10:01
【问题描述】:
我在 httpd 配置中有一个虚拟主机,其中包含多个 ProxyPass 和 Rewrite 规则,如果文件系统上存在文件,我想触发重定向。
<If "-f '/tmp/somefile'">
Redirect temp "/" "https://another.server.com/somepath/index.html"
</If>
此配置适用于其他 httpd(xubuntu 上为 2.4),但不适用于我需要的 httpd(CentOS 上为 2.4)。 apachectl configtest 验证配置OK。
/tmp/somefile 可以被 apache 读取。但是当我 touch 文件时,我猜这个条件仍然是假的,因为没有发生重定向。
我在日志中找不到任何错误。
有什么我忽略的需要注意的吗?
提前致谢
【问题讨论】:
-
在我看来,问题不在于 if,而在于 Redirect。如果我省略了 if,httpd 仍然不会重定向我的浏览器。
标签: apache centos virtualhost apache2.4