OK actually that didn't work :(
I'm doing this:
SetEnvIfExpr "%{REQUEST_URI} =~ /^(.+)(?:\?|$)/" CACHE_URI=$1
SetEnvIfExpr "md5(%{ENV:CACHE_URI}) =~ /^(.+)$/" CACHE_MD5_URI=$1
Then:
<If "-f '/home/bohwaz/cache/web/%{ENV:CACHE_MD5_URI}'">
When doing a strace I can see that Apache is doing a stat on
/home/bohwaz/cache/web/ and not on /home/bohwaz/cache/web/MD5_HASH
My understanding of the issue is that the variables defined by
SetEnvIfExpr are not available in <If> conditions.
So I resorted to using RewriteRules:
RewriteCond %{REQUEST_URI} ^(.+)(?:\?|$)
RewriteRule ^ "-" [E=CACHE_URI:%1]
RewriteCond expr "md5(%{ENV:CACHE_URI}) =~ /^(.+)$/"
RewriteRule ^ "-" [E=CACHE_URI_MD5:%1]
RewriteCond %{DOCUMENT_ROOT}/.cache/%{ENV:CACHE_URI_MD5} -f
RewriteRule ^ /.cache/%{ENV:CACHE_URI_MD5} [END]
And it works. But it would have been nice to be able to use <If> as
it's easier to read.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]