How does an expression work in apache 2.4?

Some of the expressions in Server Side Include no longer work after I upgraded the server from version 2.2 to 2.4, giving me a series of errors:

AH01337: could not parse expr "$ SERVER_NAME = abc" in /var/www/err/ft.html.var: Parse error near '$'
AH01337: Could not parse expr "! $ REDIRECT_STATUS" in / var / www / err /tp.html: Analysis error near $$
AH01337: Failed to parse expr "$ HTTP_HOST = / ^ ([az] {2} \.) abc \ .com / & & $ SERVER_NAME = abc \ .com" in / var /www/err/tp.html: parsing error next to '$'

I understand that this involves some constant effort to use only one option, called ap_expr , for all configuration directives. However, after reading the documentation, I still don't know how to convert part of my old code to reflect this change:

<!--#if expr="! $REDIRECT_STATUS" -->
<!--#set var="REDIRECT_STATUS" value="404" -->
<!--#endif -->
<!--#if expr="$HTTP_HOST = /^([a-z]{2}\.)abc\.com/ && $SERVER_NAME = abc\.com" -->
<!--#set var="subdomain" value="$1" -->
<!--#else -->
<!--#set var="subdomain" value="" -->
<!--#endif -->

I would be grateful if anyone could indicate how this would be changed to start me. Thank!

+5
source share
2 answers

WARNING

I tried to activate the directive:

SSILegacyExprParser on

(as mentioned above)

BUT this also killed my SSIStartTag configurations ..

Not more pleasant {{echo var = 'var1'}}

Remember that XHTML editors will be CHOKE if the syntax of OLD comments appears inside attributes>: - (

+1

, , - :

<!--#if expr="-z %{REDIRECT_STATUS}" -->
<!--#set var="REDIRECT_STATUS" value="404" -->
<!--#endif -->
<!--#if expr="v('HTTP_HOST') =~ /^([a-z]{2}[.])abc[.]com/
           && v('SERVER_NAME') == 'abc.com'" -->
<!--#set var="subdomain" value="$1" -->
<!--#else -->
<!--#set var="subdomain" value="" -->
<!--#endif -->

$1, , ( , , ). , , , , , , , , . URI, "/", , , % {REQUEST_URI} , v ('REQUEST_URI') (- -).

<!--#if expr="((v('REQUEST_URI') =~ m_/index.shtml_)
            || (v('REQUEST_URI') =~ m_/index.html_)
            || (v('REQUEST_URI') =~ m_/index.cgi_)
            || (v('REQUEST_URI') =~ m_/$_))" -->
0

All Articles