I moved my site to a new server, and all of my conditional SSI statements stopped working. There is plenty of documentation for using SSILegacyExprParser, but very little documentation on the new method.
I used SSI to deliver a different html file depending on the domain visited. Originally, this was to get past my web host restrictions for total domains. However, when a particular client has many domains with very simple websites, I prefer to have all files in the same folder.
After the update, I was getting the following errors in my error.log folder:
[Tue Feb 17 01:58:08.865059 2015] [include:error] [pid 4855] [client xxx.xxx.xxx.xxx:yyyyy]: Could not parse expr "$HTTP_HOST = "mysite.com"" in /var/www/mysite.com/web/index.shtml: Parse error near '$'
and
[Tue Feb 17 01:52:11.580714 2015] [include:error] [pid 4294] [client xxx.xxx.xxx.xxx:yyyyy]: Could not parse expr "%{HTTP_HOST}=mysite.com" in /var/www/mysite.com/web/index.shtml: syntax error, unexpected T_OP_CONCAT, expecting '('
This is a result of the new syntax requirements for conditional expressions in Apache 2.4 and newer. Here is the code that worked for me:
<!--#if expr='%{HTTP_HOST} = "site1.com" || %{HTTP_HOST} = "www.site1.com"' -->
<!--#include virtual="page1.html" -->
<!--#elif expr='%{HTTP_HOST} = "site2.com" || %{HTTP_HOST} = "www.site2.com"' -->
<!--#include virtual="page2.html" -->
<!--#elif expr='%{HTTP_HOST} = "site3.com" || %{HTTP_HOST} = "www.site3.com"' -->
<!--#include virtual="page3.html" -->
<!--#else-->
<!--#include virtual="others.html" -->
<!--#endif-->