Apache的SetEnvIf之后麻烦 [英] Apache SetEnvIf trouble

查看:444
本文介绍了Apache的SetEnvIf之后麻烦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在的.htaccess 文件以下内容:

SetEnvIf Host "^example\.com$" myvar=1
<IfDefine myvar>
  RewriteRule ^(.*)$ index2.php?q=$1 [L,QSA]
</IfDefine>

据我所知,这应该是正常工作。不过,MYVAR似乎并没有得到定义,当我从 example.com 参观。我知道,我有 mod_setenvif.c 启用(我以&LT核实; IfModule>配置块)

As far as I can tell, this should be working properly. However, "myvar" does not appear to get defined when I visit from example.com. I know that I have the mod_setenvif.c enabled (I've verified with an <IfModule> block).

任何想法,为什么MYVAR是没有得到界定?

Any ideas why "myvar" isn't getting defined?

推荐答案

这是一个真正的问题ServerFault,但无论如何: IfDefine 不测试环境变量,它测试被传递到Apache在启动时的配置选项。因此,例如,如果运行

This is really a ServerFault question, but anyway: IfDefine doesn't test environment variables, it tests the configuration options that were passed to Apache at startup. So for example, if you ran

apache2 -D MYVAR

然后一节

<IfDefine MYVAR>
    ...
</IfDefine>

将被执行。

我不知道是否有充当有条件的环境变量,就像你正在寻找任何Apache的配置指令。

I'm not sure if there's any Apache configuration directive that acts as a conditional for environment variables, like you're looking for.

这篇关于Apache的SetEnvIf之后麻烦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆