0

Using a constant string in a statement works fine like this:

Request with browser or curl:

https://example.com/images/filename.jpeg

In httpd.conf:

<IfFile /var/www/example/images/filename.jpeg> ...do something ... </IfFile>

But of course one wants to use variables, like:

<IfFile %{REQUEST_FILENAME}> ... </IfFile>

I can seem to get that to work. I tried many different possible syntaxes and they were all approved by apachectl configtest. However, none produces the desired result. No file is ever matched. In place of %{REQUEST_FILENAME} I've also tried %{DOCUMENT_ROOT} . %{REQUEST_URI} and "expr=%{REQUEST_FILENAME}"

I have tried all variables (REQUEST_FILENAME, REQUEST_URI, DOCUMENT_ROOT) with the prefix ENV: ( i.e %{ENV:REQUEST_FILENAME} ) and/or with quotation marks ( "%{REQUEST_FILENAME}" ).

It seems like I can't address any header variables in an <IfFile> statement.

jamacoe
  • 193
  • 2
  • 7

0 Answers0