阿帕奇2.4.3 SSI如果expr没有变量? [英] Apache 2.4.3 SSI if expr no variables?
问题描述
我有一个小的差异很多文件。所包含的文件包含此,它试图区分一个较长的路径的一部分:
I have many files with small differences. The included file contains this, which tries to differentiate on one part of a longer path:
<!--#if expr="${DOCUMENT_URI}=/internet/"-->Internet<!--#else-->Intranet<!--#endif-->
在错误日志中我得到
In the error log I get
AH01337:无法解析EXPR$ {} DOCUMENT_URI = /网络/,在/opt/apache/htdocs/ssi/time.shtml:解析错误附近的$
AH01337: Could not parse expr "${DOCUMENT_URI}=/internet/" in /opt/apache/htdocs/ssi/time.shtml: Parse error near '$'
我找到关于这一主题的很多变化,像没有括号,括号围绕引号内,空间注释年底前或=〜,但没有什么帮助。似乎没有成为mod_include负责调试设置,它会告诉我什么是错的...
I find many variations on this theme, like no braces, parentheses around the inside of the quotes, space before the comment end or =~, but nothing helps. There doesn't seem to be a debug setting for mod_include, which would tell me what's wrong...
我发现了另一个变体是
<!--#if expr='"${DOCUMENT_URI}"=~/internet/'-->
这给没有错误。但它总是与 REQUEST_URI
选择else分支,同样,仿佛变量是未设置。但我可以附和罚款他们。我也试过 /.+互联网+ /
的情况下,它被锚定这一点。
this gives no error. But it always chooses the else branch, likewise with REQUEST_URI
, as though the variables were unset. But I can echo them fine. I also tried /.+internet.+/
in case it was anchoring this.
由于这些是CGI变量我也尝试加载cgid_module - 没有好或者
Since these are CGI variables I also tried loading cgid_module – no good either.
推荐答案
截至2.3.13版本,mod_include负责已切换到有条件的前pressions新ap_expr语法在#if流量控制元件。
As of version 2.3.13, mod_include has switched to the new ap_expr syntax for conditional expressions in #if flow control elements.
添加 SSILegacyExprParser上
指令切换到旧的语法是与Apache的httpd版本2.2.x的兼容和更早版本。
Add the SSILegacyExprParser on
directive to switch to the old syntax which is compatible with Apache HTTPD version 2.2.x and earlier.
<一个href=\"http://httpd.apache.org/docs/current/mod/mod_include.html#ssilegacyexprparser\">http://httpd.apache.org/docs/current/mod/mod_include.html#ssilegacyexprparser
这篇关于阿帕奇2.4.3 SSI如果expr没有变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!